当运行完插入语句后,执行select @@identity就可得到自动生成的id
如果是sql server 最好用select SCOPE_IDENTITY() as id
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3