dataforums
Programmer
Hi guys,
I think this a simple error but i haven't been able to figure out what's wrong with the code below:
Declare temp_cur CURSOR FOR
select table_name from INFORMATION_SCHEMA.TABLES where table_name like 'SAMP_TMP_%'
OPEN temp_cur
FETCH NEXT FROM temp_cur into @temp_tab
WHILE @@FETCH_STATUS <> -1
BEGIN
declare t_cur cursor for select * from @temp_tab
OPEN t_cur
FETCH NEXT FROM t_cur INTO @id,..................... @type
WHILE @@FETCH_STATUS <> -1
BEGIN
-- some operation performed
FETCH NEXT FROM t_cur INTO @id,..................... @type
END
CLOSE t_cur
deallocate t_cur
FETCH NEXT FROM temp_cur INTO @temp_tab
END
CLOSE temp_cur
deallocate temp_cur
**********************************************************
Any idea what the problem might be?
Thanks in Advance!
I think this a simple error but i haven't been able to figure out what's wrong with the code below:
Declare temp_cur CURSOR FOR
select table_name from INFORMATION_SCHEMA.TABLES where table_name like 'SAMP_TMP_%'
OPEN temp_cur
FETCH NEXT FROM temp_cur into @temp_tab
WHILE @@FETCH_STATUS <> -1
BEGIN
declare t_cur cursor for select * from @temp_tab
OPEN t_cur
FETCH NEXT FROM t_cur INTO @id,..................... @type
WHILE @@FETCH_STATUS <> -1
BEGIN
-- some operation performed
FETCH NEXT FROM t_cur INTO @id,..................... @type
END
CLOSE t_cur
deallocate t_cur
FETCH NEXT FROM temp_cur INTO @temp_tab
END
CLOSE temp_cur
deallocate temp_cur
**********************************************************
Any idea what the problem might be?
Thanks in Advance!