I'm trying to select one record from a SQL database that has 1.3 mil records based on the serial number. Once I find that one record based on the serial number I want to query the linked server(Unidata 5.2) and pull in some records from a line item detail file 450k records. Getting one line item is the reason for the second match on the part number.
Is there another way to structure this to be a little faster? I'm hoping it is just a case of moving stuff around in the query to make it run better. Or do I just have to start playing with indexes or try to dump the data out to SQL?
SELECT TOP 1 dbo.Order_Details_View.Sales_Order_Number, dbo.Order_Details_View.Part_Number, DERIVEDTBL.Unit_Price, DERIVEDTBL.Cust_Nbr,
DERIVEDTBL.Cust_Name, DERIVEDTBL.Ship_Name, DERIVEDTBL.Ship_Address, DERIVEDTBL.Ship_City, DERIVEDTBL.Ship_State,
DERIVEDTBL.Ship_Zip, DERIVEDTBL.Bill_Of_Lading, DERIVEDTBL.Pro_Nbr, DERIVEDTBL.Description, DERIVEDTBL.Line_Nbr,
dbo.Order_Details_View.Serial_Number, DERIVEDTBL.So_Nbr, DERIVEDTBL.Part_Nbr_Strip
FROM dbo.Order_Details_View INNER JOIN
(SELECT *
FROM OPENQUERY(M2K, 'SELECT * FROM SOD_PROD_LIFE') AS M2K1) DERIVEDTBL ON
dbo.Order_Details_View.Sales_Order_Number = DERIVEDTBL.So_Nbr AND
dbo.Order_Details_View.Part_Number = DERIVEDTBL.Part_Nbr_Strip COLLATE SQL_Latin1_General_CP1_CI_AS
WHERE (dbo.Order_Details_View.Serial_Number = N'AM029516954')
Jeffrey Lettau
ERP Systems Manager
polkaudio
-- u2-users mailing list [EMAIL PROTECTED] http://www.oliver.com/mailman/listinfo/u2-users