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)
 system date

Author  Topic 

smitha
Posting Yak Master

100 Posts

Posted - 2010-01-04 : 06:51:37
hi,
the below said statement is not taking the system date.can anybody through light on this

Select * from tablename where date = 'Date & '

Smitha

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-04 : 07:08:34
Date and time is provided by GETDATE() in SQL Server.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-01-04 : 07:21:22
Select * from tablename
where
date >=dateadd(day,datediff(day,0,getdate()),0)
and
date <dateadd(day,datediff(day,0,getdate()),1)


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -