変数を sp_executesql に渡すときに変数を「カーソル」型として宣言しているにもかかわらず、「オペランド型の衝突: nvarchar はカーソルと互換性がありません」というエラーが表示されます。
declare CURSOR_TO_PASS cursor for... --a simple select statement
--cursor opened, values obtained, etc...
declare @item nvarchar(5);
declare @seqno int;
--@item and @seqno populated
declare @sql nvarchar(400) = N'update MYTABLE set Survey' + cast(@seqno as nvarchar(2)) + N' = @itemvalue where current of @sc';
exec sp_executesql @sql, N'@itemvalue nvarchar(5), @sc cursor', @itemvalue = @item, @sc = CURSOR_TO_PASS;
@sc をカーソルとして宣言しており、CURSOR_TO_PASS はカーソルであり、sp_executesql を呼び出すときに @sc に割り当てているため、何が問題なのかわかりません。では、カーソルを sp_executesql に渡すことは可能ですか?