sql server 表变量临时表的区别
sql server 表变量临时表的区别
表变量,一般用于存储小型数据。使用完毕不用销毁。一般在存储过程中使用。
临时表,使用# 来开始,需要会话结束时,会自动销毁。
全局临时表,使用## 来开始,对所有会话可见。
表变量:@table table(int id);
临时表:create table #table (int id);
sql server 表变量临时表的区别
表变量,一般用于存储小型数据。使用完毕不用销毁。一般在存储过程中使用。
临时表,使用# 来开始,需要会话结束时,会自动销毁。
全局临时表,使用## 来开始,对所有会话可见。
表变量:@table table(int id);
临时表:create table #table (int id);