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


Please Help Members By Posting Answers For Below Questions

Distinguish between nested subquery and correlated subquery?

751


What command is used to delete a table from the database in the sql server and how?

741


How to return the top 5 rows from a select query in ms sql server?

781


How can you find out how many rows returned in a cursor?

756


Explain the steps to create and execute a user-defined function in the sql server?

708






Can we do dml on views?

732


When cursors are useful?

742


Do you know what is replace and stuff function in sql server?

678


What is row_number function?

740


If you lose rights to your sql server instance what are the options to connect to sql server instance? : sql server security

717


How to create database with physical files specified in ms sql server?

725


What are the aggregate and scalar functions?

707


what is a traditional network library for sql servers? : Sql server database administration

639


What are the differences between stored procedure and the dynamic sql?

763


Difference between connected and disconnected database in .net with sql server?

772