KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a table with a single column, which is an auto-generated identity create table SingleIdTable ( id int identity(1,1) not null ) I can insert a single row with an auto-generated id with: insert into SingleIdTable default values I want to insert many rows and use the output syntax to get their ids, something like: insert into SingleIdTable output inserted.Id into @TableOfIds select (default values) from SomeOtherTable where Attribute is null Where the intention is to insert a row into SingleIdTable for each row in SomeOtherTable where Attribute is null using an auto-generated id. The above doesn't work, but how could I do it. I note that if my table had more than just a single column I could do it, but I can't select empty rows which is what I really want to do. I can't change the definition of SomeOtherTable .
Tags (comma-separated)
Save Edits
Cancel