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 the difference between TRUNCATE and DROP?
Do you know what are the differences between lost updates and uncommitted dependencies?
What are the requirements to use odbc connections in php scripts?
Explain transaction server consistency?
What is the guest user account in sql server? What login is it mapped to it? : sql server security
How do we Backup SQL Azure Data?
How to how to convert numeric expression data types using the convert() function??
what are the important architecture components of SSRS?
How is table type constraint applied to a table?
What does it mean to invest in the index?
What is the difference between a clustered index and a non-clustered index?
Hi all, can any one please tell me the difference between sql server 2008 and orace 9i
What is table-valued sub query?
1.what is the diff between nolock optimizer and read uncommitted isolation? 2.what is the diff between revoke and deny? 3.what is percieved down time? 4.whether password protection are required for backups?if yes why?if no why? 5.what is fill factor? 6.what is cost analysis? 7.what is mean by piece meal restore? 8.what is 'rowguidcol'? 9.impersonate permission? 10.what is selectivity?
What is the use of for clause?