-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path02.00.03.SqlDataProvider
141 lines (110 loc) · 4.03 KB
/
02.00.03.SqlDataProvider
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/************************************************************/
/***** SqlDataProvider *****/
/***** *****/
/***** *****/
/***** Note: To manually execute this script you must *****/
/***** perform a search and replace operation *****/
/***** for {databaseOwner} and {objectQualifier} *****/
/***** *****/
/***** *****/
/***** *****/
/************************************************************/
/************************************************************/
/***** SPROC Start *****/
/************************************************************/
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_Get]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_Get]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_Get]
@ModelID int,
@Lang nchar(5)
AS
begin
select
M.ModelID,
M.ProductID,
M.ListOrder,
M.UnitCost,
M.Barcode,
M.ModelRef,
M.Deleted,
ML.Lang,
ML.ModelName,
QtyRemaining,
QtyTrans,
QtyTransDate,
PL.ProductName,
P.PortalID,
isnull(SR.ProductWeight,0) as Weight,
isnull(SR.ProductHeight,0) as Height,
isnull(SR.ProductLength,0) as Length,
isnull(SR.ProductWidth,0) as Width,
M.QtyStockSet,
M.DealerCost,
M.PurchaseCost,
ML.[XMLData]
from {databaseOwner}[{objectQualifier}NB_Store_Model] as M
inner join {databaseOwner}[{objectQualifier}NB_Store_Products] as P on P.ProductID = M.ProductID
left outer join {databaseOwner}[{objectQualifier}NB_Store_ModelLang] as ML on ML.ModelID = M.ModelID and ML.Lang = @Lang
left outer join {databaseOwner}[{objectQualifier}NB_Store_ProductLang] as PL on PL.ProductID = M.ProductID and PL.Lang = @Lang
left outer join {databaseOwner}[{objectQualifier}NB_Store_ShippingRates] as SR on SR.ObjectID = M.ModelID and ShipType='PRD' and SR.[Disable]=0
where M.ModelID = @ModelID
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
if exists (select * from dbo.sysobjects where id = object_id(N'{databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_GetByRef]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_GetByRef]
GO
CREATE PROCEDURE {databaseOwner}[{objectQualifier}NEvoweb_NB_Store_Model_GetByRef]
@ProductID int,
@ModelRef nvarchar(20),
@Lang nchar(5)
AS
begin
select top 1
M.ModelID,
M.ProductID,
M.ListOrder,
M.UnitCost,
M.Barcode,
M.ModelRef,
M.Deleted,
ML.Lang,
ML.ModelName,
QtyRemaining,
QtyTrans,
QtyTransDate,
PL.ProductName,
P.PortalID,
isnull(SR.ProductWeight,0) as Weight,
isnull(SR.ProductHeight,0) as Height,
isnull(SR.ProductLength,0) as Length,
isnull(SR.ProductWidth,0) as Width,
M.QtyStockSet,
M.DealerCost,
M.PurchaseCost,
ML.[XMLData]
from {databaseOwner}[{objectQualifier}NB_Store_Model] as M
inner join {databaseOwner}[{objectQualifier}NB_Store_Products] as P on P.ProductID = M.ProductID
left outer join {databaseOwner}[{objectQualifier}NB_Store_ModelLang] as ML on ML.ModelID = M.ModelID and ML.Lang = @Lang
left outer join {databaseOwner}[{objectQualifier}NB_Store_ProductLang] as PL on PL.ProductID = M.ProductID and PL.Lang = @Lang
left outer join {databaseOwner}[{objectQualifier}NB_Store_ShippingRates] as SR on SR.ObjectID = M.ModelID and ShipType='PRD' and SR.[Disable]=0
where M.ModelRef = @ModelRef
and M.ProductID = @ProductID
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO