![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi "select x from tbl_Y where myDate=GetDate" I am running a dts and need to filter out todays records. I have the dates in string format but can convert them to as date dd/mm/yy but can't filter on GetDate() as this returns the date and the time. I can't find a simple way to do this and imagine there must be. The only way I can get it to work is "where datediff(d, myDate,GetDate())=0" which seems like overkill grateful for any pointers Jonathan |
#3
| |||
| |||
|
|
Hi "select x from tbl_Y where myDate=GetDate" I am running a dts and need to filter out todays records. I have the dates in string format but can convert them to as date dd/mm/yy but can't filter on GetDate() as this returns the date and the time. I can't find a simple way to do this and imagine there must be. The only way I can get it to work is "where datediff(d, myDate,GetDate())=0" which seems like overkill grateful for any pointers Jonathan |
#4
| |||
| |||
|
|
So you want in TSQL to say what records were processed/tagged with today's date? As you have discovered Getdate() returns a date and a time so that won't help you but you can do something like this WHERE CONVERT(CHAR(8),DateCol,112) = CONVERT(CHAR(8),Getdate(),112) OR if you want the rows from the last 24hours (rolling) then WHERE DateDiff(hour,DateColFromDB,getdate()) < 24 There are other ways also. -- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.SQLIS.com - You thought DTS was good. here we show you the new stuff. www.konesans.com - Consultancy from the people who know "Jonathan Crawford" <jc (AT) jcrawford (DOT) co.uk> wrote in message news:O95Cts0eFHA.2520 (AT) TK2MSFTNGP09 (DOT) phx.gbl... Hi "select x from tbl_Y where myDate=GetDate" I am running a dts and need to filter out todays records. I have the dates in string format but can convert them to as date dd/mm/yy but can't filter on GetDate() as this returns the date and the time. I can't find a simple way to do this and imagine there must be. The only way I can get it to work is "where datediff(d, myDate,GetDate())=0" which seems like overkill grateful for any pointers Jonathan |
![]() |
| Thread Tools | |
| Display Modes | |
| |