There's no need of values when you're using select as a source
this is enough
DECLARE @DATEPROCESS DATETIME; SET @DATEPROCESS = CAST(DATEADD(DAY, -((DATEPART(WEEKDAY, GETDATE()) + 1 + @@DATEFIRST) % 7), GETDATE()) AS DATE) insert into tempjoin([PART], [SPLRNAME], [SHIPDAYS], [SPRICE]) Select distinct RC. CAT_PART AS PART, RC. CAT_SUPPLIER AS SUPPLIER, FFC.[Ships Within Days] AS SHIPDAYS, ffc.[Sell Price] AS SPRICE from fri_full_Catalog FFC INNER JOIN R5PARTS RP ON (RP.PAR_UDFCHAR06 = FFC.[DSSI ITEM #] AND RP.PAR_ORG='USA' AND FFC.fri_Org='USA' and FRI_CREATED=@DATEPROCESS) INNER JOIN R5CATALOGUE RC ON RP.PAR_CODE=RC.CAT_PART AND RC.CAT_PART_ORG='USA' AND (RC.CAT_SUPPLIER=REPLACE(REPLACE([SPLR NAME],'&','-'), '''', '') and ((FFC.[Ships Within Days] <> RC.CAT_LEADTIME) OR (FFC.[Sell Price]<> RC.CAT_GROSS)))
Also using expressions in join condition can cause performance hit for large datasets as it wont be able to use an index even if one exists on the columns
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
----------------------------
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page
No comments:
Post a Comment