一个sql用法 你可能不知道哦

create table userInfo(

   uid int identity primary key,

   uname varchar(20) not null

)

 

insert into userInfo output inserted.uid,inserted.uname values('I am jacklai')

 

你执行这条语句时候  让数据库表userInfo插入了一条数据 同时也返回了你刚刚插入的那条数据

如的项目中要返回刚刚插入的信息,这样就可以了!

你可能感兴趣的:(sql)