--删除 drop proc 存储过程名 --修改 alter proc 存储过程名 as 。 --添加 create proc 存储过程名
Use 数据库 GOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].存储过程名') and OBJECTPROPERTY(id, N'IsProcedure') = 1) 前面加这个判断会好一些
SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GOALTER proc lt_inoutquery ( @querytype int, @selecttext nvarchar(4000) ) as declare @selectsql nvarchar(4000)--最终查询语句 if(@querytype=1)--历史记录查询 begin set @selectsql=@selecttext exec (@selectsql) end else if(@querytype=2)--同批次查询 begin set @selectsql=@selecttext exec (@selectsql) end else if(@querytype=3) begin set @selectsql=@selecttext exec (@selectsql) endGO SET QUOTED_IDENTIFIER OFF GO SET ANSI_NULLS ON GO
drop proc 存储过程名
--修改
alter proc 存储过程名
as
。
--添加
create proc 存储过程名
Use 数据库
GOif exists (select * from dbo.sysobjects where id = object_id(N'[dbo].存储过程名') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
前面加这个判断会好一些
GO
SET ANSI_NULLS ON
GOALTER proc lt_inoutquery
(
@querytype int,
@selecttext nvarchar(4000)
)
as
declare @selectsql nvarchar(4000)--最终查询语句
if(@querytype=1)--历史记录查询
begin
set @selectsql=@selecttext
exec (@selectsql)
end
else if(@querytype=2)--同批次查询
begin
set @selectsql=@selecttext
exec (@selectsql)
end
else if(@querytype=3)
begin
set @selectsql=@selecttext
exec (@selectsql)
endGO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO