When I try the following SQL, I get the ERRORS
listed below.
======== SQL =======
begin
declare @name varchar(20)
declare nameC cursor
for
select name from dbtable
where
id >=2 and
id <= 4
open nameC
fetch nameC into @name
while (@@sqlstatus = 0 )
begin
select @name
fetch nameC into @name
end
close nameC
deallocate cursor nameC
end
=====================
========ERRORS =======
Mg 7344, Level 15, State 2:
Server 'SYBASE', Line 5:
DECLARE CURSOR must be the only statement in a query batch.
Msg 11721, Level 15, State 1:
Server 'SYBASE', Line 15:
Global variables not allowed as defaults.
=====================
My question is then, how do I set the default
to allow global variables?
I have tried using sp_dboption, but it does not work.
======== sp_dboption ERRORS =======
1> use master
2> sp_dboption testbd, "unique auto_identity index", true
3> go
Msg 102, Level 15, State 1:
Server 'SYBASE', Line 2:
Incorrect syntax near 'sp_dboption'.
=====================
BTW, when I do sp_helpdb testbd reads with "no options set".
Any help/suggestions would be appreciated!