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