1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
|
CREATE FUNCTION [dbo].[fnGet_ItemsMissingSRPrice](@Season nchar(4))
RETURNS TABLE
AS
RETURN (
SELECT TOP (100) PERCENT
i.[ITEM-NO],
i.DESCRIPTION,
FL.SR,
FL.SRPrice,
FL.Price AS FLPrice,
DLR.Page AS FLPage,
i.STATUS,
DLR.Page AS DLRPage,
PSAS.PriceSameAs,
FL.Updates
FROM tblPSAS PSAS RIGHT OUTER JOIN
[Item Master] AS i ON PSAS.EDP = i.[EDP-NO] LEFT OUTER JOIN
tblDLR AS DLR ON i.[EDP-NO] = DLR.Edp LEFT OUTER JOIN
tblFL AS FL ON i.[EDP-NO] = FL.EDP
WHERE ((FL.Page > 1) AND (FL.Page < 500)
or (DLR.Page > 1 and DLR.Page < 400))
AND SRPrice IS NULL AND [PriceSameAs] = 'p' and brandcode<>'N'
and FL.Season=@season
and DLR.season=@season
and PSAS.season=@Season
ORDER BY FL.Page, FL.Sec, [ITEM-NO]
)
Example 1:
exec sp_executesql N'UPDATE "PriceShop".."tblPSAS" SET "PriceSameAs"=@P1 WHERE "PriceSameAs"=@P2 AND "EDP"=@P3 AND "Season"=@P4',N'@P1 nvarchar(6),@P2 nvarchar(1),@P3 int,@P4 nvarchar(4)',N'hi mom',N'p',44404,N'0909'
exec sp_executesql N'UPDATE "PriceShop".."tblDLR" SET "Page"=@P1,"Page"=@P2 WHERE "Page"=@P3 AND "Page"=@P4 AND "Edp"=@P5 AND "Season"=@P6',N'@P1 int,@P2 int,@P3 int,@P4 int,@P5 int,@P6 nvarchar(4)',98,99,25,25,44404,N'0909'
exec sp_executesql N'UPDATE "PriceShop".."tblFL" SET "Price"=@P1 WHERE "Price"=@P2 AND "EDP"=@P3 AND "Season"=@P4',N'@P1 numeric(8,2),@P2 numeric(8,2),@P3 int,@P4 nvarchar(4)',36.33,26.99,44404,N'0909'
|