Table variable 比 temporary table 好用多了,不用最后 drop table 了
声明方式:
declare @IDTable table (KeyNumber int identity(1,1), ID bigint)
但是在存储过程中也不能嵌套插入,就是说
insert @IDTable exec XXX
如果SP XXX里有 insert into Table variable/temporary table 的话,也会爆插入嵌套错误
但是有个问题 table variable 不能用在 拼接的字符串语句里