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 2005 Forums
 Transact-SQL (2005)
 Appending data from another table

Author  Topic 

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2008-09-25 : 09:22:18
I am trying to append rows from another table using

SELECT * INTO newtable
FROM sourceTable

but SQL Server 2005 complains, as newTable already exists.
What should I have done please?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-25 : 09:24:13
[code]INSERT INTO newtable (fields..)
SELECT fields.. FROM OldTable[/code]

Also make sure you're using corresponding columns in insert and select list
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-25 : 09:24:38
INSERT INTO newtable(columns)
SELECT columns FROM sourceTable


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-25 : 09:25:11


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-25 : 09:27:40
quote:
Originally posted by madhivanan



Madhivanan

Failing to plan is Planning to fail


by 25 secs
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-09-25 : 09:46:48
quote:
Originally posted by visakh16

quote:
Originally posted by madhivanan



Madhivanan

Failing to plan is Planning to fail


by 25 secs


As usual you are fast

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -