我收到语法错误,说这个选择格式错误......不确定原因。
Insert into @MyTableVariable (select @new_identity, Name from Company where soemField = 'some text value')
@new_identity只是在前一个插入语句之后设置为scope_identity()的int var
答案 0 :(得分:2)
Insert into @MyTableVariable (newIdentityColName, nameName)
select @new_identity, Name from Company where someField = 'some text value'