0
create procedure dbo.move_pos
(
@id int,
@tbl varchar(50)
)
as
begin
declare @pos int
exec('select '[email protected]+'=POS from '[email protected]+' where id='[email protected])
exec('update '[email protected]+' set POS=POS+1 where POS<'[email protected])
end
在上述过程中,列POS的类型为int。但是,当我米执行该过程它显示以下错误:SQL存储过程中的动态表名称和参数
消息102,级别15,状态1,行1
附近有语法错误 '='。
我使用SQL SERVER 2012.需要帮助。提前致谢 !!!
选择 '+ @ POS +'=从'+ @ TBL +的POS其中id ='+ @ ID西隧ü要做到与@ pos –
试试这个 declare query varchar(100); (查询) add @before查询,id,pos –
@YashveerSingh I m试图移动一个项目顶部,所以我使用pos。 – SUPU