Mr.Muddasar
I need data from multipe database to compaine into single table for analysis purpose.
I have tried this
Declare @dbname varchar(50),@sqlCommand varchar(1000)
Set @dbname ='dbname'
set @sqlCommand = '
SELECT RegDate, SID, Name, CAddress, TelEM1, TelEM2, Relation, Disablity, Loan, TRStatus
FROM' + @dbname + 'dbo.MemberRecord '
EXEC (@sqlCommand)
Error is
Msg 102, Level 15, State 1, Line 15
Incorrect syntax near '.'.
if i using the below code, working fine
SELECT RegDate, SID, Name, CAddress, TelEM1, TelEM2, Relation, Disablity, Loan, TRStatus
FROM [dbname].dbo.[MemberRecord] ORDER BY SID
Pls Advice me
Thank you
Maideen