chama
chama

Reputation: 6163

Inserting data into a sql server 2008 table

Is there a relatively simple way to insert multiple rows into a table in which the data being inserted comes from both a select statement and hard-coded data?

For example,

insert into tblB 
  (field1, field2, field3) 
values 
  ( 950, select fieldA, fieldB from tblA )

...where 950 is a hard-coded value and fieldA and fieldB come from tblA

Upvotes: 2

Views: 8791

Answers (2)

Durairaj
Durairaj

Reputation: 149

insert into tablename(fieldname1,fieldname2,...)values(value1,value2,....)

Upvotes: 0

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171411

insert into tblB 
(field1, field2, field3) 
select 950, fieldA, fieldB 
from tblA

Upvotes: 9

Related Questions