![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Ok here is the scenario. I have a text file that contains all the data. I have a SQL Server db that has tables for that data. Currently I backup the old table, then truncate it, then insert the new data. I do this for about 5 tables. The text file always has the newest data. I do this nightly so I was wondering if there is a better way to get the data inserted into the table, is this the most efficient. How are most of you doing it? It seems like there is a better way to accomplish that. What are your thoughts? |
#4
| |||||
| |||||
|
|
Ideally you would have the rows that have been changed during that day/period appearing in the text file only. |
|
removing all data and BULK INSERTing it back in from text file will be incredibly quick but obviously the more rows |
|
Import the text files into Scratch Tables INSERT = Key Col in Source not in Dest DELETE = Key Col in Dest not in Source UPDATE = Key col in Source and Dest |
|
The problem here being that short of comparing all columns in Source and Dest you will have to issue a |
|
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.allisonmitchell.com - Expert SQL Server Consultancy. www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Mike" <anonymous (AT) discussions (DOT) microsoft.com> wrote in message news:a0a801c3eb27$66505b20$a401280a (AT) phx (DOT) gbl... Ok here is the scenario. I have a text file that contains all the data. I have a SQL Server db that has tables for that data. Currently I backup the old table, then truncate it, then insert the new data. I do this for about 5 tables. The text file always has the newest data. I do this nightly so I was wondering if there is a better way to get the data inserted into the table, is this the most efficient. How are most of you doing it? It seems like there is a better way to accomplish that. What are your thoughts? . |
#5
| |||
| |||
|
|
-----Original Message----- Hi Mike, Congratulations on your concern. Can you post DDL and description for the tables? The reason I ask is to analyze if there are integrity constraints,indexes or checks involved. ----- Mike wrote: ----- Ok here is the scenario. I have a text file that contains all the data. I have a SQL Server db that has tables for that data. Currently I backup the old table, then truncate it, then insert the new data. I do this for about 5 tables. The text file always has the newest data. I do this nightly so I was wondering if there is a better way to get the data inserted into the table, is this the most efficient. How are most of you doing it? It seems like there is a better way to accomplish that. What are your thoughts? . |
#6
| |||
| |||
|
|
I don't have the db info with me but I can tell you that on each table there is a multicolumn index (ex. id, date, name, ssn) There are no constraints or checks involved only the indexes I have to be concerned with. How reliable is DTS for everyday use, I just fear it dying in the middle of the import process. -----Original Message----- Hi Mike, Congratulations on your concern. Can you post DDL and description for the tables? The reason I ask is to analyze if there are integrity constraints,indexes or checks involved. ----- Mike wrote: ----- Ok here is the scenario. I have a text file that contains all the data. I have a SQL Server db that has tables for that data. Currently I backup the old table, then truncate it, then insert the new data. I do this for about 5 tables. The text file always has the newest data. I do this nightly so I was wondering if there is a better way to get the data inserted into the table, is this the most efficient. How are most of you doing it? It seems like there is a better way to accomplish that. What are your thoughts? . |
![]() |
| Thread Tools | |
| Display Modes | |
| |