views:

38

answers:

1

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

+9  A: 
insert into tblB 
(field1, field2, field3) 
select 950, fieldA, fieldB 
from tblA
RedFilter
950 is not from tblA - will this still work?
chama
@chama: 950 is a static value, it doesn't need to exist in the table
OMG Ponies
@chama: YES! Try it!
marc_s
It worked - Thank you so much!
chama