读书人

为什么这段sql语句不能连续执行解决思

发布时间: 2012-01-29 21:39:32 作者: rapoo

为什么这段sql语句不能连续执行
--创建Table_Dept表
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING OFF
GO
if exists (select * from sys.tables where name='#Table_Dept')
drop table #Table_Dept
go
create table #Table_Dept
(
[Dept_Id] [int] identity(1,1) not null,
[Dept_Name] [nvarchar](200) not null
)

[解决办法]

SQL code
if object_id('Tempdb..#Table_Dept') is not nulldrop table #Table_Deptgocreate table #Table_Dept(  [Dept_Id] [int] identity(1,1) not null,  [Dept_Name] [nvarchar](200) not null)
[解决办法]
SQL code
--创建Table_Dept表SET QUOTED_IDENTIFIER ONGOSET ANSI_PADDING OFFGOif object_id('#Table_Dept') is not nulldrop table #Table_Deptgocreate table #Table_Deptgo(  [Dept_Id] [int] identity(1,1) not null,  [Dept_Name] [nvarchar](200) not null) 

读书人网 >SQL Server

热点推荐