例如:
如下数据:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[reptq3]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[reptq3]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[test]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[test]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE reptq3 @lolimit money, @hilimit money,
@type char(12)
AS
select pub_id, type, title_id, price
from titles
where price >@lolimit AND price <@hilimit AND type = @type OR type LIKE '%cook%'
order by pub_id, type
COMPUTE count(title_id) BY pub_id, type
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE test
@s varchar(20),
@str char(10)
AS
select @s,@str
select @str
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
代码大致是这样,问题就是,提示GO附近出错,如果是单独的创建存储过程就没有这种问题,如下代码示例:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[test]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[test]
GO
CREATE PROCEDURE test
@s varchar(20),
@str char(10)
AS
select @s,@str
select @str