sql创建临时表语句 如何用sql语句删除一个临时表?
如何用sql语句删除一个临时表?
通过SQL语句删除临时表的方法:
1。删除语句:
drop tableᦇtemporary table name drop tableᦇtemporary table name
2。ᦇ表示本地临时表,ᦇ表示全局临时表
以井号(ᦇ)开头的本地临时表的表名。这些表仅在创建本地临时表的连接上可见。以两个星号(#)开头的全局临时表的名称。您可以在所有连接上看到全局临时表。如果在创建全局临时表的连接断开之前没有显式删除这些表,那么只要所有其他任务停止引用它们,就会删除这些表。当创建全局临时表的连接断开时,新任务不能再引用它们。一旦当前语句被执行,任务和表之间的关联就被删除。因此,一般来说,只要创建全局临时表的连接断开,就会删除全局临时表。
3、创建临时表的方法
方法1,创建没有数据的临时表:
创建表#临时表名称(字段1约束,字段2约束,…)
创建表#临时表名称(字段1约束,字段2约束,…)
示例:
创建表格#表格uTemp(xh int,test uuColumn char(10))
方法2,根据表搜索结果创建一个临时表:[Select*into#temporary table name from table name
Select*into#temporary table name from table name
示例:[Select*into#table#search临时表的数据,Select*fromᦇtemporary table name Select*fromᦇtemporary table name就像普通表一样
sql创建临时表语句 sql 创建临时表 sql表中插入数据
版权声明:本文内容由互联网用户自发贡献,本站不承担相关法律责任.如有侵权/违法内容,本站将立刻删除。