My SQL query looks something like this and am executing it in SQLCMD
mode in SSMS:
DECLARE @tempTable TABLE(acct nvarchar(50))
INSERT INTO @tempTable (Acct)
(select acct from tUsers)
:CONNECT otherserver
USE XXXDb
Select *
from tUserInfo
inner join @tempTable on tUserInfo.Acct = @tempTable.Acct
GO
The problem is :
Before inserting all the records into @tempTable
, the :CONNECT
gets executed. Hence the query fails :( :( :(
Please help me out :(