sql如何实现带参数调用存储过程
我现在有一个SQL的存储过程S但是这个存储过程可能出现问题了,想要带参数跑一下。求大神知道如何带着实参跑这个存储过程。具体语句怎么写SETANSI_NULLSONGOSE...
我现在有一个SQL的存储过程 S 但是这个存储过程可能出现问题了,想要带参数跑一下。求大神知道如何带着实参跑这个存储过程。具体语句怎么写
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[s]
(
@User bigint,
@BG int,
@BD int,
@ProjectType int,
@Project int,
@CustomerId int,
@CountryId int,
--AAD 23/06/2009
--@RSCId int,
@regionId int,
@RUCUId int,
@ClusterId int,
@Red_Kpi int,
@ProjectReviewer int,
@Program varchar(255),
@PM int,
@ProjectStatus int,
@Archive bit
)
AS
SET NOCOUNT ON
IF @Archive = 1
BEGIN
EXEC s @User,@BG,@BD,@ProjectType,@Project,@CustomerId,@CountryId,@RegionId,@RUCUId,@ClusterId,@Red_Kpi,@ProjectReviewer,@Program,@PM,@ProjectStatus,@Archive
END
所有这些参数 要求全部都是数据库里所有的数据。不知道这样的实参到底怎么写 展开
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[s]
(
@User bigint,
@BG int,
@BD int,
@ProjectType int,
@Project int,
@CustomerId int,
@CountryId int,
--AAD 23/06/2009
--@RSCId int,
@regionId int,
@RUCUId int,
@ClusterId int,
@Red_Kpi int,
@ProjectReviewer int,
@Program varchar(255),
@PM int,
@ProjectStatus int,
@Archive bit
)
AS
SET NOCOUNT ON
IF @Archive = 1
BEGIN
EXEC s @User,@BG,@BD,@ProjectType,@Project,@CustomerId,@CountryId,@RegionId,@RUCUId,@ClusterId,@Red_Kpi,@ProjectReviewer,@Program,@PM,@ProjectStatus,@Archive
END
所有这些参数 要求全部都是数据库里所有的数据。不知道这样的实参到底怎么写 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励20(财富值+成长值)
2个回答
展开全部
MySQL教程4 MySQL8运算符、函数、存储过程及新增数据类型 17.之创建带有IN和OUT参数的存储过程 学习猿地
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
declare @str varchar (max) ='
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[s]
('+
@User +' bigint,'+
@BG +' int,'+
@BD +' int,'+
@ProjectType +' int, +'
@Project +' int, +'
@CustomerId +' int, +'
@CountryId +' int, +'
--AAD 23/06/2009
--@RSCId int,
@regionId +' int, +'
@RUCUId +' int, +'
@ClusterId +' int, +'
@Red_Kpi +' int, +'
@ProjectReviewer +' int, +'
@Program +' varchar(255), +'
@PM +' int, +'
@ProjectStatus +' int, +'
@Archive +' bit
)
AS
'
SET NOCOUNT ON
IF @Archive = 1
BEGIN
EXEC (@STR)
END
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[s]
('+
@User +' bigint,'+
@BG +' int,'+
@BD +' int,'+
@ProjectType +' int, +'
@Project +' int, +'
@CustomerId +' int, +'
@CountryId +' int, +'
--AAD 23/06/2009
--@RSCId int,
@regionId +' int, +'
@RUCUId +' int, +'
@ClusterId +' int, +'
@Red_Kpi +' int, +'
@ProjectReviewer +' int, +'
@Program +' varchar(255), +'
@PM +' int, +'
@ProjectStatus +' int, +'
@Archive +' bit
)
AS
'
SET NOCOUNT ON
IF @Archive = 1
BEGIN
EXEC (@STR)
END
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询