一个Oracle表有字段:ID、Name、Description,其中ID是个自增的字段,我要执行下面这个SQL语句后,获得加入记录的ID值,请问如何实现?谢谢
insert into SecurityIdentity (Name,IdentityType) values ('test1','UserAccount')
insert into SecurityIdentity (Name,IdentityType) values ('test1','UserAccount')
调试欢乐多
降序查询 获得首记录
注意:我不想再次人为控制的执行SQL语句
as
declare @SID int
select @SID=MAX(strid) from SecurityIdentity
if (@SID is null)
select @SID=1001
else
select @SID=@SID+1
insert into SecurityIdentity values (@SID,'test1','UserAccount')
go
调用就可以直接
exec ist 'test1','UserAccount'如何 ??