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.
| Author |
Topic |
|
redrunner
Starting Member
4 Posts |
Posted - 2006-04-07 : 08:40:12
|
| Hi,i´m going to create a dts-package, that runs every month and deletes all rows from a table having a date within the last three months.For example:The table is containing data from 01.06.2005.My dtd-job runs on 07.04.2006. Now, all rows between 01.01.2006 and31.03.2006 shall be deleted.By the way: I´ve tried to "PRINT" something out. Where are those lines written in when executing the dts-package?Can anyone help me please? Thx a lot.Greetzredrunner |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2006-04-07 : 08:46:42
|
| They aren't unless you have a log file for the dts..Just write the SQL statements in QA..Post your SQL here if you need help with it.. |
 |
|
|
redrunner
Starting Member
4 Posts |
Posted - 2006-04-07 : 08:53:05
|
| could you help me with the t-sql-statement.i have nothing till now, because i have no idea of t-sql.I know a little bit of sql.greetz |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-07 : 08:56:57
|
| Delete from yourTable where datecol<DateAdd(Month,DateDiff(Month,0,getdate()),0)MadhivananFailing to plan is Planning to fail |
 |
|
|
redrunner
Starting Member
4 Posts |
Posted - 2006-04-07 : 09:15:55
|
| thanks a lot for your help.I just want to delete the last three months.My my example: 01.01.2006 til 31.03.2006What would be the t-sql-statement for that?greetzredrunner |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-04-07 : 09:24:24
|
| It seems you didnt run the query I suggestedRun thisSelect * from yourTable where datecol<DateAdd(Month,DateDiff(Month,0,getdate()),0)If you get data from your specified dates, then run the delete statementMadhivananFailing to plan is Planning to fail |
 |
|
|
redrunner
Starting Member
4 Posts |
Posted - 2006-04-07 : 13:23:43
|
| I´ll try to run it on monday because i´m out of office today.Thanks a lot for your help. I´ll give you my feedback on MondayHave a nice weekendgreetzredrunner |
 |
|
|
|
|
|
|
|