create table with fields ID, reserved_by,res_date
res_date is datefield like 2010-03-09 00:00:00.000 from
2005 to 2006 any date assume
based on res_date need to slect table and display
based on month (full jan details in database irrespective
of date and year
Answer Posted / sandip
//Show records for a given month
SELECT * FROM table_name (NOLOCK)
WHERE SUBSTRING(res_date, 6, 2) = (numeric value for month.
eg 01 for Jan)
//Show all the records sorted by res_date based on month.
SELECT * FROM table_name (NOLOCK)
ORDER BY SUBSTRING(res_date, 6, 2) ASC
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is a join in sql?
How do I port a number to sql server?
What is the difference between the export /import functions in sql studio and standalone sql manager? : sql server management studio
What is the difference between DataRow.Delete() and DataRow.Remove()?
Tell me about normalization in DBMS.
what are the steps you will take, if you are tasked with securing an sql server? : Sql server database administration
What are the new data types are introduced in sql 2000?
What is default constraint?
Is oracle faster than sql server?
How to execute the cursor queries with "open" statements?
what is a major difference between sql server 6.5 and 7.0 platform wise? : Sql server database administration
What you can do to delete a table without the delete trigger firing?
Explain how to use linked server?
What is the function of inner join?
How would you choose between a clustered and a non-clustered index?