存储过程中的sql语句,改成变量就不行了,详细请进
huzx 2003-08-25 11:51:03 我在存储过程中使用下面的语句可以
update table1 set id=@id where id_2 in (select top 2 id_2 from goods where col3 is null)
但把2改为一个变量@count就不行了
即:
update table1 set id=@id where id_2 in (select top @count id_2 from goods where col3 is null)
其中@count定义了,且在前面已经赋过值