I am trying to do an insert statement utilizing a variable string.
something like:
Set @.cString = 'SELECT top 10 *
FROM OPENDATASOURCE(
' + char(39) + 'SQLOLEDB' + char(39) + ',' + char(39) +
'Data Source=' + @.lServer + ';User ID=' + @.user + ';Password=' + @.pword + char(39) + '
).myServer..
Insert into #Temp_table (field1, field2)
select exec @.cString
--What is the syntax for this?as answered in previous post. you can like so:
insert tb
exec(@.sql)|||When I do something like:
Insert into #tACCOUNT (ACCOUNTID, ACCOUNT, TYPE)
exec (@.cString)
I get:
MSDTC on server 'myServer' is unavailable.|||dtc is needed to ensure data integrity between 2 sites. when you do any dml, the transaction is implicitly promoted to a distributed transaction.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment