Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
Hello I'm running this:INSERT INTO itemsNRSH(columns...)SELECT columns...FROM itemsWHERE (ReleaseDate like 'GETDATE()') AND (StockQty > 0)The releasedate column is formatted like so 2013-06-11 00:00:00.000. How can I get it to look at todays date "GETDATE()" when it runs? Right now when it runs it retrieves (0 row(s) affected).Thanks
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts
Posted - 2013-06-11 : 17:45:12
where -- ReleaseDate GE today at 00:00:00.000 ReleaseDate >= dateadd(dd,datediff(dd,0,GETDATE()),0) and -- ReleaseDate before tomorrow at 00:00:00.000 ReleaseDate < dateadd(dd,datediff(dd,0,GETDATE())+1,0) and StockQty > 0
CODO ERGO SUM
taunt
Posting Yak Master
128 Posts
Posted - 2013-06-11 : 17:52:18
Hhhmmm I should have used CURDATE(). That worked fine. Thanks for your reply.
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts
Posted - 2013-06-11 : 21:58:38
If you wanted a MySQL solution, you should have posted on a MySQL forum.CODO ERGO SUM