Have following query:CREATE TABLE #JDE_Table (jde_job_numbers char(12) )declare @LibFile as char(18)declare @Location char(10)set @Location = 'South'declare @SQLSTRING as varchar(4000)SET NOCOUNT ONSET @SQLSTRING = 'SELECT * FROM OPENQUERY( AS400SRV_MSDASQL, ''select @@mcu as job_number from ' + @LibFile + 'order by @@mcu'')'insert into #JDE_Table (jde_job_numbers )exec (@SqlString)select CompanyJobId as JobNamefrom [VGIWPSQL2].goLabor30.dbo.Job inner join #JDE_Table on #JDE_Table.jde_job_numbers = [VGIWPSQL2].goLabor30.dbo.Job.CompanyJobIdorder by CompanyJobId
On my last select I get error:Msg 4104, Level 16, State 1, Line 47The multi-part identifier "VGIWPSQL2.goLabor30.dbo.Job.CompanyJobId" could not be bound.If I remove this line it works fine:inner join #JDE_Table on #JDE_Table.jde_job_numbers = [VGIWPSQL2].goLabor30.dbo.Job.CompanyJobId
Thank you.