Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamic SQL, Linked Servers, and Insert Statements

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-25 : 12:20:26
kevin writes "The following code works from within a procedure going against a local SQL 7 sp 2, NT 4 sp 6a server:

INSERT #temp
EXECUTE sp_ExecuteSQL
@SQL, @VariableString, @variable1, @variable2, etc.

where @SQL is the query string, @VariableString is a string of the expected variables and their definitions, and the others are those variables.

However, this same code fails when it goes against a linked server. The error: "Server: Msg 3910, Level 16, State 1, Line 1 Transaction context in use by another session." (This error is not documented in BOL.)

Interestingly, if you comment out the "INSERT #temp", it will run just fine against the linked server. (In either case, local or linked, the FROM statements are fully qualified.)

Same set of issues occur when we try:
INSERT #temp
EXECUTE (@SQL)

Is this a bug with Linked Servers? Or a limitation of TSQL? Or some setup issue? Any thoughts?

Many thanks!
Kevin"
   

- Advertisement -