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 3 ways to get a count of the number of records in a table?
What is difference between views and stored procedures?
Why is normalisation important?
What are the types of table?
How to execute stored procedure and set temp table in sql server?
Explain different types of collation sensitivity?
How to create indexed view?
What is rolap and its advantage? : sql server analysis services, ssas
What is nonclustered index with included columns ?
Define ACID properties in a Database?
What protocol does sql server use?
What command is used to create a database in the sql server and how?
How to remove duplicate rows from table?
What is normalization of database? What are its benefits?
What action plan is preferred if sql server is not responding?