CREATE PROCEDURE ItemImgBinarySUpdate
@ItemNo nvarchar(50),  --对应字段:ItemNo
@ImgBinary image=null, --对应字段:ImgBinary
@ImgBinary2nd image=null --对应字段:ImgBinary2nd
AS
主要Binary,哪一个空,就不跟新对应的字段,如果两个都有值,都更新到表ItemImgTB里面。
另外要加影响到就记录。更新成功一个或者两个字段,返回>=1。如果失败或者两个ImgBinary都为空则返回0谢谢!

解决方案 »

  1.   

    image没修改过,可以用@@rowcount函数判断吧
      

  2.   

    CREATE PROCEDURE ItemImgBinarySUpdate 
    @ItemNo nvarchar(50),  --对应字段:ItemNo 
    @ImgBinary image=null, --对应字段:ImgBinary 
    @ImgBinary2nd image=null ,--对应字段:ImgBinary2nd 
    @n int output
    AS 
    begin 
    if(@ImgBinary is not null and @ImgBinary is  null )
    begin 
    update ItemImgTB
    set ImgBinary=@ImgBinary 
    set @n=1
    end
    else if(@ImgBinary is  null and @ImgBinary is not  null )
    begin
    update ItemImgTB
    set ImgBinary2nd =@ImgBinary2nd  
    set @n=1
    end
    else if(@ImgBinary is  null and @ImgBinary is not  null )
    begin
    update ItemImgTB
    set ImgBinary2nd =@ImgBinary2nd  ,
    ImgBinary=@ImgBinary 
    set @n=2
    end
    else 
    set @n=0
    end
      

  3.   

    我是这样写的,不知道可以不,没有调试。明天自己调试看看。
    CREATE PROCEDURE ItemImgBinarySUpdate
    @ItemNo nvarchar(50),
    @ImgBinary image=null,
    @ImgBinary2nd image=null
    AS
    declare @RowC int
    if  @ImgBinary is not null 
    Begin
    Update [ItemImgTB] Set ImgBinary=@ImgBinary Where ItemNo=@ItemNo
    set @RowC=@@RowCount
    End
    if  @ImgBinary2nd is not null
    Begin
    Update [ItemImgTB] Set ImgBinary2nd=@ImgBinary2nd Where ItemNo=@ItemNo
    set @RowC=@RowC+@@RowCount
    End
    Select @RowC
    GO
      

  4.   

    大家帮我看看啊。
    还有
    CREATE PROCEDURE ItemImgBinarySDelete
    @ItemNo nvarchar(50),  --对应字段:ItemNo 
    @ImgDeletFlag int --来更新字段:ImgBinary ImgBinary2nd =null
    --Flag: 1更新第一个,2更新第二个,3两个都更新为空.
    应该怎么写。
      

  5.   

    多写几个IF判断一下,应该就行了,得到影响的函数,可以使用@@RowCount
      

  6.   


    这个就可以了,MARK一下,自己写写看看。然后发自己的结果上来