首页 > 数据库技术 > 详细

sp_executesql 两种写法

时间:2014-08-02 12:45:33      阅读:299      评论:0      收藏:0      [点我收藏+]

写法1:

AlTER PROCEDURE TryAgain
@ReturnValue int output    
AS
declare @aa nvarchar(1000),
        @ForumID int,
        @count int,
        @TotalRecords int
BEGIN
set @ForumID =1    
set @aa=Nselect  @ReturnValue=count(1) from TC_BBS_Topics tc_bt where ForumID=+convert(varchar(10),@ForumID)
EXEC sp_executesql @aa,N@ReturnValue int output ,@ReturnValue   output

END

写法2:

AlTER PROCEDURE TryAgain
@ReturnValue int output    
AS
declare @aa nvarchar(1000),
        @ForumID int,
        @count int
BEGIN
set @ForumID =1    ;

set @aa=Nselect  @count=count(1) from TC_BBS_Topics tc_bt where ForumID=@id;

EXEC sp_executesql @aa,N@id int,@count int output ,@id = @ForumID, @count=@ReturnValue   output;

END

 

sp_executesql 两种写法,布布扣,bubuko.com

sp_executesql 两种写法

原文:http://www.cnblogs.com/fuge/p/3886699.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!