- 使用@@IDENTITY
例如:insert into student(name,age) values('fanqi',23) select @@identity
- 使用 OUTPUT inserted
例如:INSERT INTO UserInfo(Username,LogName,[Password],resTime) OUTPUT inserted.UserID VALUES ('12345','56789','112233',GETDATE())
例如:insert into student(name,age) values('fanqi',23) select @@identity
例如:INSERT INTO UserInfo(Username,LogName,[Password],resTime) OUTPUT inserted.UserID VALUES ('12345','56789','112233',GETDATE())
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。