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 |
|
bobshishka
Yak Posting Veteran
72 Posts |
Posted - 2007-08-15 : 12:45:19
|
| I have 1 table in my db that I have imported from a txt file using DTS.In my database "DOJ" I have a table named "DOJGRAB" with ALL my data fresh from a import using DTS.Also in "DOJ" are 6 other tables (NAME, PERSON, etc...)How can I parse the columns out from my DOJGRAB table to fill existing columns in my other 6 tables? Basically a copy of specific columns from DOJGRAB to their proper places in the other tables.Can somebody post an example of the syntax I would use to copy a column from one table to another? Thanks! |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-15 : 12:49:51
|
| [code]Insert into Name (column1, col3)SELECT Column1, col3FROM DOJGRABWHERE ....[/code]Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-15 : 12:50:02
|
| you haven't specified your problem in full.in the original table do you have one column with all data delimited by a separator or many columns that you just have to put in other tables?_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
bobshishka
Yak Posting Veteran
72 Posts |
Posted - 2007-08-15 : 12:55:47
|
quote: Originally posted by spirit1 you haven't specified your problem in full. in the original table do you have one column with all data delimited by a separator or many columns that you just have to put in other tables
To create the original table (DOJGRAB) I have used DTS to translate a fixed width txt file into a table split into 72 named columns. Now that I have the data in a SQL I want to copy it into its correct locations in multiple tables residing in the same database. Thanks |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-08-15 : 12:57:19
|
| then do what dinakar suggested._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
bobshishka
Yak Posting Veteran
72 Posts |
Posted - 2007-08-15 : 14:48:28
|
| Yup, I did it and it worked great. Of course now I have a follow up question.... :o)Step 1- I run my DTS Local package to import my data. Works great.Step 2- I have a SQL script to parse out all the data. Works Great.How do I automate it so that when DTS completes I can run the SQL script (INSTER_DATA.sql) to parse the data? Can I include that in my DTS?Thanks |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-08-15 : 14:52:51
|
| Yes I think so. After your data loads, you can add another SQL Task and put your SQL Script in it.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
bobshishka
Yak Posting Veteran
72 Posts |
Posted - 2007-08-15 : 16:11:49
|
| Great, thanks! |
 |
|
|
|
|
|