-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMerge_King.sql
79 lines (76 loc) · 1.94 KB
/
Merge_King.sql
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
-- Create a new stored procedure called 'MergeKing' in schema 'dbo'
-- Drop the stored procedure if it already exists
IF EXISTS (
SELECT *
FROM INFORMATION_SCHEMA.ROUTINES
WHERE SPECIFIC_SCHEMA = N'dbo'
AND SPECIFIC_NAME = N'MergeKing'
)
DROP PROCEDURE dbo.MergeKing
GO
-- Create the stored procedure in the specified schema
CREATE PROCEDURE dbo.MergeKing
@param1 /*parameter name*/ int /*datatype_for_param1*/ = 0, /*default_value_for_param1*/
@param2 /*parameter name*/ int /*datatype_for_param1*/ = 0 /*default_value_for_param2*/
-- add more stored procedure parameters here
AS
-- body of the stored procedure
SELECT * FROM Angela.ALGONA217
UNION ALL
SELECT * FROM Angela.BELLEVUE17
UNION ALL
SELECT * FROM ANGELA.BLACKDIAMOND217
UNION ALL
SELECT * FROM ANGELA.BURIEN17
UNION ALL
SELECT * FROM Angela.CARNATION17
UNION ALL
SELECT * FROM Angela.CLYDEHILL17
UNION ALL
SELECT * FROM ANGELA.COVINGTON17
UNION ALL
SELECT * FROM ANGELA.DESMOINES17
UNION ALL
SELECT * FROM Angela.ENUMCLAW17
UNION ALL
SELECT * FROM Angela.FEDERALWAY17
UNION ALL
SELECT * FROM ANGELA.ISSAQUAH217
UNION ALL
SELECT * FROM ANGELA.KENMORE17
UNION ALL
SELECT * FROM Angela.KENT17
UNION ALL
SELECT * FROM Angela.KIRKLAND17
UNION ALL
SELECT * FROM ANGELA.LAKEFORESTPARK17
UNION ALL
SELECT * FROM ANGELA.MAPLEVALLEY17
UNION ALL
SELECT * FROM Angela.MEDINA17
UNION ALL
SELECT * FROM Angela.MERCERISLAND17
UNION ALL
SELECT * FROM ANGELA.NEWCASTLE17
UNION ALL
SELECT * FROM Angela.NORMANDYPARK17
UNION ALL
SELECT * FROM Angela.SAMMAMISH17
UNION ALL
SELECT * FROM ANGELA.SEATAC17
UNION ALL
SELECT * FROM ANGELA.SEATTLE217
UNION ALL
SELECT * FROM Angela.SHORELINE17
UNION ALL
SELECT * FROM Angela.SNOQUALMIE17
UNION ALL
SELECT * FROM ANGELA.UNINCORPORATEDKING17
UNION ALL
SELECT * FROM Angela.WOODINVILLE217
UNION ALL
SELECT * FROM ANGELA.YARROWPOINT17
GO
-- example to execute the stored procedure we just created
EXECUTE dbo.MergeKing 1 /*value_for_param1*/, 2 /*value_for_param2*/
GO