I started writing this stored procedure and it keeps claiming:
Server: Msg 16915, Level 16, State 1, Line 23
A cursor with the name 'statcur' already exists.
Server: Msg 16905, Level 16, State 1, Line 25
The cursor is already open.
here is the code as I am not at my best today:
Server: Msg 16915, Level 16, State 1, Line 23
A cursor with the name 'statcur' already exists.
Server: Msg 16905, Level 16, State 1, Line 25
The cursor is already open.
here is the code as I am not at my best today:
Code:
declare @type char(2)
set @type = 'PL'
--select * from AFinance100
declare @startgl varchar(12),
@endgl varchar(12),
@statementAcc varchar(10),
@curbalance money,
@acctCur cursor
Declare @sheet table
(Account varchar(10),
AccountName nvarchar(50),
Balancecy money,
Balancepy money,
totalsto varchar(10))
insert into @sheet select distinct sacc, snam, 0.00,0.00, stot from AFinance100 where ftyp = @type
declare statcur CURSOR FOR select distinct Account from @sheet
open statcur
fetch next from statcur into @statementAcc
while @@fetch_status = 0
begin
select @statementAcc
fetch next from statcur into @statementAcc
end
select * from @sheet