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() function to fetch records from sql database

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-05-23 : 08:07:25
writes "How to fetch records as per current system date with help of getdate function.
Select userid,bookid from rentbooks
where duedate=getdate()
this query is not showing any result.If <= or >= operator r used it shows records perfectly right.
thank you,
sejal"

nr
SQLTeam MVY

12543 Posts

Posted - 2005-05-23 : 08:18:52
Select userid,bookid from rentbooks where datediff(dd,duedate,getdate()) = 0
Select userid,bookid from rentbooks where duedate=convert(varchar(8),getdate(),112)

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -