dataforums
Programmer
I get an error message for the foll. dynamic sql code:
********************************************************
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
PRINT 'Record Status' + CAST(@@FETCH_STATUS as varchar)
WHILE @@FETCH_STATUS <> -1
BEGIN
set @orig_tab = replace(@temp_tab,'_TMP','')
set @str='SAMP_TMP_%'
select @@STR1='select '+@orig_tab+' from INFORMATION_SCHEMA.TABLES
where table_name like '+char(39)+''+@str+''+char(39)+''
exec @@STR1
END
*******************************************************
ERROR:
Server: Msg 2812, Level 16, State 62, Line 23
Could not find stored procedure 'select SYNC_DATAFORUMSERVER from INFORMATION_SCHEMA.TABLES
where table_name like 'SAMP_TMP_%''.
*******************************************************
********************************************************
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
PRINT 'Record Status' + CAST(@@FETCH_STATUS as varchar)
WHILE @@FETCH_STATUS <> -1
BEGIN
set @orig_tab = replace(@temp_tab,'_TMP','')
set @str='SAMP_TMP_%'
select @@STR1='select '+@orig_tab+' from INFORMATION_SCHEMA.TABLES
where table_name like '+char(39)+''+@str+''+char(39)+''
exec @@STR1
END
*******************************************************
ERROR:
Server: Msg 2812, Level 16, State 62, Line 23
Could not find stored procedure 'select SYNC_DATAFORUMSERVER from INFORMATION_SCHEMA.TABLES
where table_name like 'SAMP_TMP_%''.
*******************************************************