我希望该过程首先检查临时表是否已经存在。如果是,则删除表格并继续选择表格。但我得到了这个错误:
'CREATE/ALTER PROCEDURE' must be the first statement in a query batch.
我的代码如下所示:
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[GetData]
@Param_Id int
AS
BEGIN
If OBJECT_ID('temp_table') is not null
drop table temp_table
select data_info into temp_table
from data_info_table1
END
但我不断收到同样的错误。有什么建议么?