我有使用 scope_identity()
的存储过程
Create table table1
id int,name varchar,age int
Create procedure details
@id int,@name varchar,age int
Select @old_id = id,@name = name,@age = age
from table1
where id = @id
if @old_id is null
begin
insert into table1(id,name,age)
Select scope_identity(),@name,@age
end
我得到的错误:
id 列不能插入空值,列不允许空值,插入失败
知道如何解决这个问题吗?任何帮助表示赞赏。