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
 Transact-SQL (2000)
 SELECT INTO functionality, but with append

Author  Topic 

dcarva
Posting Yak Master

140 Posts

Posted - 2004-11-15 : 12:11:34
Hello,

I currently use SELECT INTO to copy data from a table into a temporary table without using DTS. However, I also want to be able to append data to a table. Unforunately, SELECT INTO does not append data into a table. It actually creates the table. So how can I select data into an existing table? I tried BULK INSERT but it only works with a data file. It seems like my only other option is to insert the data row by row. Is there a simpler way?

Thanks!

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-11-15 : 12:20:03
INSERT INTO

- Jeff
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-11-15 : 12:23:19
Right, I could use INSERT INTO, but I would have to create a row at a time. Right? ( Unlike SELECT INTO, where it can select the data to insert using a WHERE clause.)

Thanks
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-11-15 : 12:26:17
no -- read up on it in Books On-Line.

INSERT INTO DestTable (Col1, Col2, ...)
SELECT Col1, Col2, ...
FROM SourceTable

The SELECT part is any normal SELECT statement, with joins and filters and whatever you need.

- Jeff
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-11-15 : 13:29:12
Very cool. Thanks!
Go to Top of Page
   

- Advertisement -