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.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Table to table transfer question

Author  Topic 

srowan
Starting Member

4 Posts

Posted - 2004-08-18 : 18:01:02
I'm new to using DTS. I am trying to transfer data from one table (let's call it TableA) to another table (TableY). TableY contains all the same fields that TableA does (except for a couple auto-populating fields), but also contains a number of extra fields that cannot be set to NULL (so tranferring TableA's data and then running an UPDATE on the remaining field isn't an option). I have constant values that I would like to put into the the fields that TableA does not have. How do I set it up so I can tranfer TableA's data along with the constant values over to TableY?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-18 : 18:05:27
INSERT INTO TableY (Column1, Column2, Column3, Column4)
SELECT Column1, Column2, 1, 2
FROM TableA

You don't need DTS for this. Just use INSERT with a SELECT. Put the constant in the SELECT like above. For the column list, just make sure you select only the ones that want.

Tara
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-08-18 : 18:18:14
Or you could use that select statement as the source in the dts transformation if you really must.

==========================================
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.
Go to Top of Page

srowan
Starting Member

4 Posts

Posted - 2004-08-19 : 09:55:08
Thanks for the help. That worked very well.
Go to Top of Page
   

- Advertisement -