Hi,
Is there any way I can remain in context during an update to another table? The problem I'm having is that if I capture the current table I'm in to a variable, and then perform a USE statement, I immediatly leave the context of my current table for the new one. Now, if I do an EXECUTE statement - such as EXECUTE ('USE '+@dbnameIcaptured) - the db switches back, but only for the context of the execute statement. What I really want to be able to do is perform a 'batch' switch, e.g - switch from the current table to master table, perfrom some delete operations, and swtich back - but the EXECUTE command only takes a single statement, and chaining multiple statements together in sp_executesql doesn't help either, as it treats each uniquely. I'm at a loss here, can someone suggest I can perform this operation.
thanks
Yum.
Is there any way I can remain in context during an update to another table? The problem I'm having is that if I capture the current table I'm in to a variable, and then perform a USE statement, I immediatly leave the context of my current table for the new one. Now, if I do an EXECUTE statement - such as EXECUTE ('USE '+@dbnameIcaptured) - the db switches back, but only for the context of the execute statement. What I really want to be able to do is perform a 'batch' switch, e.g - switch from the current table to master table, perfrom some delete operations, and swtich back - but the EXECUTE command only takes a single statement, and chaining multiple statements together in sp_executesql doesn't help either, as it treats each uniquely. I'm at a loss here, can someone suggest I can perform this operation.
thanks
Yum.