Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 finding in between date

Author  Topic 

prashant6388
Starting Member

1 Post

Posted - 2009-12-12 : 00:54:10
i hav table(emp) with some records having attribute date with data type date-time.
(e.g. 11/12/2005, 16/11/2008, 29/12/2005 in dd/mm/yyyy )

now i want to find the records with month=11;

suggest me a query.

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2009-12-12 : 01:03:08
Hi, Try this once

select * from table where datepart(mm,datecolumn) = 11
Go to Top of Page

learntsql

524 Posts

Posted - 2009-12-13 : 23:25:42
DECLARE @iMonthNo int
SET @iMonthNo = 11

SELECT *
FROM <Table>
WHERE MONTH(<DateColumn>)=@iMonthNo
Go to Top of Page
   

- Advertisement -