database - Get SQL Server remote procedure result -
i have 2 sql server 2005, want pull data b.
i execute code on b.:
create table #res ( valueid int, [timestamp] varchar(32), realvalue float, quality int, flags int ); insert #res(valueid, [timestamp], [realvalue], [quality], [flags]) exec ('exec [cc_externalbrowsing].[dbo].[cc_sp_readtags] @list=''1;2;3;4;5'', @timebegin=''0000-00-00 00:05:00.000'', @timeend=''0000-00-00 00:00:00.000''') @ [winccteszt] select * #res; drop table #res
exec part runs fine (without previous insert line). can see data in ssms, can't insert data temp table
i error:
the procedure 'sys.addlinkedserver' cannot executed within transaction.
any ideas?
thanks
zui
use table-valued variable instead of explicit temp table - table-creation cannot occur within transaction. try instead:
declare @res table ( valueid int, [timestamp] varchar(32), realvalue float, quality int, flags int ); insert @res(valueid, [timestamp], [realvalue], [quality], [flags]) exec ('exec [cc_externalbrowsing].[dbo].[cc_sp_readtags] @list=''1;2;3;4;5'', @timebegin=''0000-00-00 00:05:00.000'', @timeend=''0000-00-00 00:00:00.000''') @ [winccteszt] select * @res; -- drop table @res -- no longer needed
Comments
Post a Comment