mercredi 25 février 2015

How can we select data from another table during an insert?


I'm trying to insert data into a table using a few columns that are hard-coded or are static values and then the rest of the datat selected from another table. I've tried the following query:



insert into wtdocversion
values (( select id from wtdocmaster),'col2','col3');


But this generates an error:



Msg 512, Level 16, State 1, Line 1


Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.






Aucun commentaire:

Enregistrer un commentaire