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 are indexes in sql?
Explain some stored procedure creating best practices or guidelines?
What is the purpose of the master database?
List the various tools available for performance tuning?
What it means to be triggered?
How to divide query output into multiple groups with the group by clause in ms sql server?
What is row-level compre?
What is difference between rownum and row_number?
Create a dts package to produce a text file using the ‘update statistics’ command for the tables in a database with obsolete statistics.
Explain can you implement data mining in ssrs?
What does <> symbol mean?
What do you mean by table and field in sql?
What are the advantages of using stored procedures in sql server?
what are the different types of replication you can set up in sql server? : Sql server database administration
What is compound operators?