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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / thangas sujith prabu.s
select * from tablename where res_date>'2010-01-01
00:00:00.000' and res_date<'2010-02-01 00:00:00.000'
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / anilkumar manthena
select * from <Table> where datepart(month,res_date)=1
It will return all the reservations made on Month "January".
Ex:
SELECT DATEPART(month, '2009-02-13 18:35:06.523')
retrieves the value 2.
Is This Answer Correct ? | 1 Yes | 1 No |
What are different types of statements that are supported by sql?
How to use wildcard characters in like operations in ms sql server?
Explain the properties of subqueries in sql server?
What is query processing?
Can a stored procedure call itself(recursive). If yes what level and can it be controlled.?
How to create function with parameter in sql server?
what is normalization? : Sql server database administration
What is 4nf in normalization form?
how to use DTS package in 2000,2005,2008 in sql server
What do you understand by the data quality services in sql server?
Explain data warehousing in sql server?
What is meant by indexing?