写一条存储过程,实现往User中插入一条记录并返回当前UserId(自增长id) --推荐写法 if(Exists(select * from sys.objects where name=N'Usp_InsertedID')) drop proc Usp_InsertedID go create proc Usp_InsertedID as insert into [User] output inserted.UserID values(N'张三蛋',3) --另一种写法(SCOPE_IDEN…
假设对表 TXxxxxxxx 表新插入一条记录,然后要 SELECT 出刚刚插入的这条记录.可使用 SCOPE_IDENEITY(); 处理.具体代码参考如下: INSERT INTO TXxxxxxxx(...) VALUES(...) DECLARE @LastInsertId INT = 0; SET @LastInsertId = SCOPE_IDENTITY(); SELECT * FROM TGamePrizePoolWinRecord AS tppwr WHERE id = @La…
代码下载:https://files.cnblogs.com/files/xiandedanteng/fastfilltable20191222.rar 表testtb18的结构如下: CREATE TABLE testtb18 ( id NUMBER not null primary key, name NVARCHAR2() not null, createtime ) not null ) 三个字段,正好是常用的number,nvarcha2,timestamp类型. 用java程序创建这…