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
 General SQL Server Forums
 New to SQL Server Programming
 insert from one table to another table

Author  Topic 

saiabhiram
Starting Member

17 Posts

Posted - 2010-04-18 : 21:29:21
Hello,

I have a scenario where I have one table in Sql Server table A and another table B which has the columns of the same datatype as table A but it also has some additional columns.

Now, what exactly I need is if I want to populate a record from Table A into Table B (only the columns with similar datatypes) and populate the additional columns in table B with hardcoded values.


Any reply is greatly appreciated and it would be good for me if you guys can be more specific as I am new to database programming.

Thanking you in Advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-04-18 : 21:38:28
[code]
INSERT INTO tableb ( <column list> )
select <column list>, 'hardcoded value 1', 'hardcoded value 2'
from tablea
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -