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 / 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 |
Post New Answer View All Answers
Distinguish between nested subquery and correlated subquery?
What command is used to delete a table from the database in the sql server and how?
How to return the top 5 rows from a select query in ms sql server?
How can you find out how many rows returned in a cursor?
Explain the steps to create and execute a user-defined function in the sql server?
Can we do dml on views?
When cursors are useful?
Do you know what is replace and stuff function in sql server?
What is row_number function?
If you lose rights to your sql server instance what are the options to connect to sql server instance? : sql server security
How to create database with physical files specified in ms sql server?
What are the aggregate and scalar functions?
what is a traditional network library for sql servers? : Sql server database administration
What are the differences between stored procedure and the dynamic sql?
Difference between connected and disconnected database in .net with sql server?