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
Which are the third-party tools used in sql server and why would you use them?
Ms sql server index?
What is single-user mode?
What is the difference between ROW_NUMBER and Ranking function in SQL SERVER?
What do you understand by SQL*Net?
What are unicode character string data types in ms sql server?
How to delete duplicate records based on single column from a table?
What are the parts of a function?
Who is the owner of a schema in ms sql server?
What are the common performance issues in sql server?
Why use stored procedures in sql server?
what is denormalization and when would you go for it? : Sql server database administration
How many databases instances are there in sql server 2000?
What does Master database contains?
What are the components of dbms?