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 2000 Forums
 Transact-SQL (2000)
 GETDATE

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-06-23 : 10:12:34
mohammed writes "ihave table named united contain curancy price iwant to make select statment like below
select * from table1 where Tdate =GETDATE()
to get the price for curent date but i dont get any record in the result
although im fill the table with the curent date


regard"

jharwood
Starting Member

41 Posts

Posted - 2004-06-23 : 10:16:55
try select * from table1 where Tdate = convert(char(10),getdate(),101)
Go to Top of Page

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2004-06-23 : 11:10:50
select * from table1 where DATEDIFF(dd, Tdate, getdate()) = 0

quote:
select * from table1 where Tdate = convert(char(10),getdate(),101)
won't work if Tdate has a time element
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-06-23 : 11:50:57
[code]
select * from table1 where dateadd(dd,datediff(dd,0,Tdate),0) = dateadd(dd,datediff(dd,0,getdate()),0)
[/code]
Go to Top of Page
   

- Advertisement -