数据库创建临时表

来源:互联网 发布:菜鸟网络上市 编辑:程序博客网 时间:2024/06/06 03:01

数据库创建临时表:

IF not exists (select * from sysobjects where id = object_id(N'temp_inventory') and type='U')

select * into temp_inventory 

from  inventory

语句解释:

1、IF not exists (select * from sysobjects where id = object_id(N'temp_inventory') and type='U'):

判断将要创建的表名(temp_inventory)是否存在

temp_inventory:将要创建的临时表

 sysobjects:系统对象表

2、select * into temp_inventory  from  inventory :创建临时表

原创粉丝点击