当前位置: 代码迷 >> Sql Server >> 看一下:asp中调用有返回值的存储过程中碰到的奇怪有关问题
  详细解决方案

看一下:asp中调用有返回值的存储过程中碰到的奇怪有关问题

热度:0   发布时间:2016-04-27 17:44:44.0
看一下:asp中调用有返回值的存储过程中碰到的奇怪问题
存储过程如下:
-----------------------------------------
create     procedure   test
(
    @Num         varchar(50),                        
    @Msg         varchar(200)   OUTPUT        
)
AS
BEGIN
    if(@Num   =1)
        begin
            set   @Msg   =   '你传入的是1 '
            exec( 'print   1 ')
        end
    else   if(@Num   =2)
        begin
            set   @Msg   =   '你传入的是2 '
            exec( 'print   2 ')
        end
END
--------------------------
SQL中调用此存储过程语句:
declare   @Num         varchar(50)
declare   @Msg         varchar(200)
set   @Num   =   '2 '
exec   test   @Num,@Msg   OUTPUT
print   @Msg

问题:[email protected],@Msg变量中都会有值。
[email protected]??把中间的那句exec( 'print   * ')[email protected]@[email protected]?终有值。
高手们!谢谢了哦。!

------解决方案--------------------
...
AS
set nocount on--试试
BEGIN
....
  相关解决方案