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 |
|
Kristen
Test
22859 Posts |
Posted - 2004-07-25 : 07:31:42
|
I want to transfer records between two SQL boxes, connected by a relatively slow link.The task is to upload stock levels and is something along the lines of-- Get most recently received dateSELECT @MyCutoffDate = MAX(UpdateDate)FROM TargetServer.MyDB.dbo.StockTable-- Update records changed SINCE this dateUPDATE TARGETSET StockLevel = SRC.StockLevelFROM SourceServer.MyDB.dbo.StockTable AS SOURCE TargetServer.MyDB.dbo.StockTable AS TARGET ON TARGET.PartNo = SOURCE.PartNoWHERE SOURCE.UpdateDate >= @MyCutoffDate This will be sceduled to run each hour.If there any difference (performance is the key, but maybe there are other considerations?) between scheduling this on the TARGET [pull] or SOURCE [push] servers?I presume, because both ends are SQL Server, that the above "style" is fine and I don't need to consider using OPENQUERY or any other fancy style?ThanksKristen |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-25 : 13:09:49
|
| It shouldn't matter what server you set it up on because the entire process will be handled as a remote procedure call, unless one server is significantly "better" than the other server. In that case, I would set it up on the fastest server just because that's where the work will theoretically be done. If this is a lot of records though, it might be faster to find the correct records, bcp them into a staging table, then run the update against that.MeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-25 : 13:20:38
|
| The table has a lot of rows, but the "WHERE SOURCE.UpdateDate >= @MyCutoffDate" will be small - I presume the actual recodset is produced at the Remote end, and then ONLY the matching rows are transferred to the Target? (What I would call Client/Server<g>)Kristen |
 |
|
|
derrickleggett
Pointy Haired Yak DBA
4184 Posts |
Posted - 2004-07-25 : 13:24:41
|
| That would be correct. Of course, I would test it on both ends just to be sure. :)TestMeanOldDBAderrickleggett@hotmail.comWhen life gives you a lemon, fire the DBA. |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-07-25 : 14:44:49
|
"Test"Will this do?:--Clean up after yourself. gheeshDROP TABLE kristen_test Kristen |
 |
|
|
|
|
|
|
|