直接用@cookie不行吗?干嘛又给个参数

解决方案 »

  1.   

    我是想根据通过传入的@id从表1中获取字段值
    然后insert到另张表里
      

  2.   


    楼主的这句有问题set @image =''select pro_image from  heda_Products where pro_id=''+@id;
      

  3.   

    改成这样:
    set @image ='select pro_image from  heda_Products where pro_id= ' + ''' + isnull(@id,'0') + '''  
      

  4.   


    create proc aa
    (
    @cookie nvarchar(150) out,@id int 
    )
    as
    declare @image nvarchar(150);
    set @image ='select pro_image from  heda_Products where pro_id= ' + ''' + isnull(@id,'0') + ''' ;
    set @cookie=@image ;insert into heda_catbiao(biao_image) values(''+@cookie+'');
    return @cookie
    消息 102,级别 15,状态 1,过程 aa,第 9 行
    '0' 附近有语法错误。
    还是不行,
      

  5.   


    结果把字段都放进字段
    22 NULL NULL NULL select pro_image from  heda_Products where pro_id= '+ @id + ' 1