title: Is it possible to pass a cursor variable to sp_executesql?
body: <p>Despite declaring a variable as type "cursor" when passing it to sp_executesql, I get the error "Operand type clash: nvarchar is incompatible with cursor".</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>I don't know what's wrong, because I've declare @sc as a cursor, and CURSOR_TO_PASS is a cursor, which I'm assigning to @sc when calling sp_executesql.  So, is it possible to pass a cursor to sp_executesql?</p>