dbTalk Databases Forums  

I want to collect all records older than 10 days from today from a

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss I want to collect all records older than 10 days from today from a in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jarkko
 
Posts: n/a

Default I want to collect all records older than 10 days from today from a - 10-06-2005 , 04:52 AM






I transform data from a DB2 table to a SQL tabel. The date format in the DB2
is in decimal 10 chr (and we need in taht format since a report generator
uses that format). But I want to replicate data that is Today-10 days so my
string is:

select * from mvxbdtm.meslog where meslog.locono=1 and LORGDT>20050926

so I need manually change the date every day.

Does someone know how to change from @date to a decimal but this does not
work:

select * from mvxbdtm.meslog where meslog.locono=1 and LORGDT>@date-10



Reply With Quote
  #2  
Old   
Jacco Schalkwijk
 
Posts: n/a

Default Re: I want to collect all records older than 10 days from today from a - 10-06-2005 , 07:22 AM






select * from mvxbdtm.meslog where meslog.locono=1 and
LORGDT>CONVERT(CHAR(8), GETDATE() -10, 112)

Btw, your code return the data newer than the last 10 days, not older.

--
Jacco Schalkwijk
SQL Server MVP


"Jarkko" <Jarkko (AT) discussions (DOT) microsoft.com> wrote

Quote:
I transform data from a DB2 table to a SQL tabel. The date format in the
DB2
is in decimal 10 chr (and we need in taht format since a report generator
uses that format). But I want to replicate data that is Today-10 days so
my
string is:

select * from mvxbdtm.meslog where meslog.locono=1 and LORGDT>20050926

so I need manually change the date every day.

Does someone know how to change from @date to a decimal but this does not
work:

select * from mvxbdtm.meslog where meslog.locono=1 and LORGDT>@date-10





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.