select id,card from user where id =5
declare @i bigint,@j bigint
----下面的语句要用上面select出来的值,赋值给两个变量??
----好像行不通!(存储过程)该怎么处理
set @i=id
set @j=card 
--------------------
上面的变量@i和@j怎么赋值呀?它们的值要从user表中查询!上面的写法是错的!

解决方案 »

  1.   

    declare @i bigint,@j bigint
    select @i=id,@j=card from user where id =5
      

  2.   

    A SELECT statement that assigns a value to a variable must not be combined with data-retrieval operations.
    下面的存储过程执行时,有上面的错误!怎么办??
    -----------------------
    declare @i bigint,@j bigint,@action intSELECT @i=ID,@j=ENTRY_ID,STEP_ID,@action=ACTION_ID,OWNER,START_DATE,FINISH_DATE,STATUS 
    FROM CurrentStep 
    WHERE ENTRY_ID=2169EXEC InsertHistoryStep @i,@j,@action,@action,OWNER,NULL,NULL,"OldStatus",STATUS,"Actioner"