forked from aravindsuri/ADFTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusp_LoadStageProduct.sql
More file actions
43 lines (33 loc) · 3.26 KB
/
Copy pathusp_LoadStageProduct.sql
File metadata and controls
43 lines (33 loc) · 3.26 KB
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
USE [WineStoreDW]
GO
/****** Object: StoredProcedure [dbo].[usp_LoadStageProduct] Script Date: 01.02.2023 10:05:07 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Script for SelectTopNRows command from SSMS ******/
CREATE PROCEDURE [dbo].[usp_LoadStageProduct]
AS
BEGIN
TRUNCATE TABLE [stage].[Product]
INSERT INTO stage.Product
(
[ProductNo],[Country],[Score],[DealerPrice],[Markup],[ListPrice],[Province],[Region_1],[Title],[Vintage],[Varietal],[Winery]
)
SELECT [ProductId],[Country],[Score],[DealerPrice],[Markup],[ListPrice],[Province],[Region_1], [Title],ISNULL([Vintage], 9999),[Variety],[Winery]
FROM [stage].[Arancione_Products]
INSERT INTO stage.Product
(
[ProductNo],[Country],[Score],[DealerPrice],[Markup],[ListPrice],[Province],[Region_1],[Title],[Vintage],[Varietal],[Winery]
)
SELECT [ProductId],[Country],[Score],[DealerPrice],[Markup],[ListPrice],[Province],[Region_1], [Title],ISNULL([Vintage], 9999),[Variety],[Winery]
FROM [stage].[Verde_Products]
INSERT INTO stage.Product
(
[ProductNo],[Country],[Score],[DealerPrice],[Markup],[ListPrice],[Province],[Region_1],[Title],[Vintage],[Varietal],[Winery]
)
SELECT [ProductId],[Country],[Score],[DealerPrice],[Markup],[ListPrice],[Province],[Region_1], [Title],ISNULL([Vintage], 9999),[Variety],[Winery]
FROM [stage].[Celeste_Products]
DELETE Stage.Product WHERE Title is NULL
UPDATE Stage.Product SET Region_1 = Province WHERE Region_1 Is NULL
END