sql - variable assignment is not allowed in a cursor declaration -
i trying use cursor in sql , getting "variable assignment not allowed in cursor declaration." & "incorrect syntax near keyword 'as' " error. following query :
declare @descriptor nvarchar(420) declare cur_descriptor cursor static select @descriptor = descriptor (select * ix_mesh terms = 'tumors') child select terms ix_mesh descriptor = @descriptor open cur_descriptor fetch next cur_descriptor @descriptor while @@fetch_status = 0 begin print @descriptor fetch next cur_descriptor @descriptor end close cur_descriptor deallocate cur_descriptor
any suggestions??
what hard error message? cursor declaration:
declare cur_descriptor cursor static select @descriptor = descriptor ----------^ (select * ix_mesh terms = 'tumors') child
that assignment no-no. do:
declare cur_descriptor cursor static select descriptor (select * ix_mesh terms = 'tumors') child;
or, better yet:
declare cur_descriptor cursor static select descriptor ix_mesh terms = 'tumors';
Comments
Post a Comment