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 |
|
rookie_sql
Constraint Violating Yak Guru
443 Posts |
Posted - 2006-05-09 : 04:20:26
|
| Hi I've a extract that I run each night and it only extracts the pervious days data I just use a a select statement and a where clause like Where (CreateDT >= convert(datetime,convert(char(8),getdate()-1,112))) to get the data, what I want to do it when I bring the data across from server 1 to server 1 I'd like to insert a date stamp on it, so am only update the data I bring across each night instead of updating all the data again and again. At the moment am using this as the insert date the function puts the date format into dd/mm/yy and am only updating where the Insert_date = 'NULL' will this work ???Update tbl_RCAset Insert_date = dbo.udf_date_only(getdate()-1)where Insert_date = 'NULL' |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-05-09 : 04:37:28
|
| Do you want the previous days data or everything from the start of the previous day?You have everything from the start of the previous day?The previous days data would beWhere CreateDT >= convert(datetime,convert(char(8),getdate()-1,112))and CreateDT < convert(datetime,convert(char(8),getdate(),112))If you do that then you probably don't need to worry about when it is inserted as you know it is only that days data.Otherwise I would hold your start and end dates in a table and use that to record when and what is transferred. This would be more flexible as you would just transfer data starting from the previous transfer end date and if the transfer fails it would be self recovering as it would transfer the missed data the next time.==========================================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. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-05-09 : 04:45:07
|
| orWhere CreateDT >=DateAdd(day,DateDiff(day,0,getdate()),-1) and CreateDT <DateAdd(day,DateDiff(day,0,getdate()),1)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|