日期:2014-05-18  浏览次数:20687 次

为什么这段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 null
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

--创建Table_Dept表
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING OFF
GO
if object_id('#Table_Dept') is not null
drop table #Table_Dept
go
create table #Table_Dept
go
(
  [Dept_Id] [int] identity(1,1) not null,
  [Dept_Name] [nvarchar](200) not null
)