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)
 Insert records from another table plus...

Author  Topic 

dani2
Starting Member

32 Posts

Posted - 2008-02-07 : 05:18:40
Hi

I have 2 tables, first having one more column than the second. The tables structure is the same exepting the extra column in 1st table.

How can I insert into 1st table values from the second table plus one more column (the extra column has same value for all rows) into one single insert query?


thank you

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-07 : 05:30:19
INSERT INTO Table1(F1,F2,...,FN,AddlField)
SELECT F1,F2....FN,'the common value'
FROM Table2
Go to Top of Page
   

- Advertisement -