jdallen75
asked on
Using Linked Servers in multi-part identifiers
Below is a stored procedure that existed prior to an archiving strategy being implemented.
Now after archiving, two of the tables (OEEEvent and OEEEventFlexData) now exist on an archive server, set up as a Linked Server.
For my reporting on archived items, I need it revised to:
SELECT
[MyLinkedServer].[ArchiveD B].[Archiv eUser].OEE Event.tSta rt,
OEEConfigEvent.sDescriptio n AS sEventDesc,
[MyLinkedServer].[ArchiveD B].[Archiv eUser].OEE EventFlexD ata.sFlex1 String AS VIN,
[MyLinkedServer].[ArchiveD B].[Archiv eUser].OEE EventFlexD ata.sFlex2 String AS CSN,
[MyLinkedServer].[ArchiveD B].[Archiv eUser].OEE EventFlexD ata.dFlex3 Numeric AS [Tracking Number],
dbo.Cus_Orders.BR_Broadcas tTimestamp AS BroadcastTime,
[MyLinkedServer].[ArchiveD B].[Archiv eUser].OEE Event.dSta rt,
dbo.Cus_Platforms.Platform Name, dbo.Cus_Platforms.Platform Label,
dbo.Cus_Orders.BR_Commodit yPart1 AS [Part Number],
dbo.Cus_Orders.BR_PVI AS [PVI]
etc....
I get an error of the form "The multi-part identifier "MyLinkedServer.ArchiveDB. ArchiveUse r.Table.Co lumn" could not be bound.
Suggestions?
Now after archiving, two of the tables (OEEEvent and OEEEventFlexData) now exist on an archive server, set up as a Linked Server.
For my reporting on archived items, I need it revised to:
SELECT
[MyLinkedServer].[ArchiveD
OEEConfigEvent.sDescriptio
[MyLinkedServer].[ArchiveD
[MyLinkedServer].[ArchiveD
[MyLinkedServer].[ArchiveD
dbo.Cus_Orders.BR_Broadcas
[MyLinkedServer].[ArchiveD
dbo.Cus_Platforms.Platform
dbo.Cus_Orders.BR_Commodit
dbo.Cus_Orders.BR_PVI AS [PVI]
etc....
I get an error of the form "The multi-part identifier "MyLinkedServer.ArchiveDB.
Suggestions?
SELECT
OEEEvent.tStart,
OEEConfigEvent.sDescription AS sEventDesc,
OEEEventFlexData.sFlex1String AS VIN,
OEEEventFlexData.sFlex2String AS CSN,
OEEEventFlexData.dFlex3Numeric AS [Tracking Number],
dbo.Cus_Orders.BR_BroadcastTimestamp AS BroadcastTime,
OEEEvent.dStart,
dbo.Cus_Platforms.PlatformName, dbo.Cus_Platforms.PlatformLabel,
dbo.Cus_Orders.BR_CommodityPart1 AS [Part Number],
dbo.Cus_Orders.BR_PVI AS [PVI]
FROM BizwareUser.OEEEvent WITH (READUNCOMMITTED)
LEFT OUTER JOIN BizwareUser.OEEEventFlexData ON OEEEvent.lOEEEventId = OEEEventFlexData.lOEEEventId
LEFT OUTER JOIN BizwareUser.OEEConfigEvent ON OEEConfigEvent.lOEEConfigEventId = OEEEvent.lOEEConfigEventId
LEFT OUTER JOIN dbo.Cus_Orders ON (OEEEventFlexData.dFlex3Numeric = dbo.Cus_Orders.TrackingNumber)
AND (dbo.Cus_Orders.BR_VIN = OEEEventFlexData.sFlex1String)
AND (dbo.Cus_Orders.CSNNumber = OEEEventFlexData.sFlex2String)
--Modified Aug 14/07
--LEFT OUTER JOIN dbo.Cus_PlatformID_By_PartID ON dbo.Cus_PlatformID_By_PartID.BroadCastPartNumber = dbo.Cus_Orders.BR_CommodityPart1
LEFT OUTER JOIN dbo.Cus_PlatformID_By_PartID ON (dbo.Cus_Orders.BR_CommodityPart1 = dbo.Cus_PlatformID_By_PartID.BroadCastPartNumber) and (dbo.Cus_Orders.Make = dbo.Cus_PlatformID_By_PartID.Make or dbo.Cus_PlatformID_By_PartID.Make is null)
LEFT OUTER JOIN dbo.Cus_Platforms ON (dbo.Cus_PlatformID_by_PartID.PlatformID = dbo.Cus_Platforms.PlatformNumber)
WHERE (OEEConfigEvent.sFolder = 'Torque Wrench Data')
AND (OEEEventFlexData.sFlex2String = @CSN)
AND (OEEEvent.loeeconfigworkcellid <> 1000004)
AND (OEEEvent.loeeconfigworkcellid <> 1000005)
GROUP by tStart,OEEConfigEvent.sDescription, sFlex1String, sFlex2String, dFlex3Numeric, dbo.Cus_Orders.BR_CommodityPart1,
dbo.Cus_Orders.BR_PVI, PlatformName, PlatformLabel, dStart, dbo.Cus_Orders.BR_BroadcastTimestamp
ORDER BY sEventDesc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER