Reputation: 15817
Is is possible to do this in SQL i.e. use a SELECT
statement to generate an INSERT
value:
insert into [processing].dbinputfields ([description], fieldtypeid, datasetid)
values ('ID', + select id from [processing].dbfieldtype where description='URN' + ,6)
I know I could assign the value of ID to a variable (@ID). However, I was wandering if it could be done like the SQL statement above.
Upvotes: 0
Views: 75
Reputation: 17600
You can do insert select
statement in SQL Server.
Change your query to this:
insert into [processing].dbinputfields ([description], fieldtypeid, datasetid)
select 'ID', id, 6
from [processing].dbfieldtype
where description = 'URN'
Upvotes: 2