I am trying to do the following:
DECLARE @command varchar (1024)
DECLARE login_curs CURSOR FOR
exec REMOTE_SERVER.someDB.dbo.generate_sql_statements
OPEN login_curs
FETCH NEXT FROM login_curs INTO @command
WHILE (@@fetch_status <> -1)
BEGIN
Exec sp_executesql @command
FETCH NEXT FROM login_curs INTO @command
END
CLOSE login_curs
DEALLOCATE login_curs
Is this possible somehow?
I am trying to have one stored procedure
generate many statements of of a linked
server. Those statements must then be executed
on the local server. The statements generated
may total more than 8000 characters so I cannot
use a vachar as a datatype and apperently you
cannot use a "text" data type as a return value.
Is this an impossible dream?
Thanks.
DECLARE @command varchar (1024)
DECLARE login_curs CURSOR FOR
exec REMOTE_SERVER.someDB.dbo.generate_sql_statements
OPEN login_curs
FETCH NEXT FROM login_curs INTO @command
WHILE (@@fetch_status <> -1)
BEGIN
Exec sp_executesql @command
FETCH NEXT FROM login_curs INTO @command
END
CLOSE login_curs
DEALLOCATE login_curs
Is this possible somehow?
I am trying to have one stored procedure
generate many statements of of a linked
server. Those statements must then be executed
on the local server. The statements generated
may total more than 8000 characters so I cannot
use a vachar as a datatype and apperently you
cannot use a "text" data type as a return value.
Is this an impossible dream?
Thanks.