-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProperty_Amenity.sql
131 lines (111 loc) · 2.4 KB
/
Property_Amenity.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
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
CREATE PROCEDURE anthony_insert_Property_amenity
@Quant int,
@PAddress varchar(50),
@AName VARCHAR(30),
@PZip varchar(9)
AS
DECLARE @P_ID INT, @A_ID INT
SET @P_ID = (SELECT PropertyID
FROM tblPROPERTY
WHERE PropAddress = @PAddress
AND PropZipCode = @PZip)
SET @A_ID = (SELECT AmenityID
FROM tblAMENITY
WHERE AmenityName = @AName)
BEGIN TRANSACTION H1
INSERT INTO tblPROPERTY_AMENITY(PropertyID, AmenityID, Quantity)
VALUES (@P_ID, @A_ID, @Quant)
COMMIT TRANSACTION H1
GO
drop procedure anthony_insert_Property_amenity
go
EXECUTE anthony_insert_Property_amenity
@Quant = 2,
@PAddress = '762 Hayes St APT 18',
@AName = 'Bedroom',
@PZip = '98109'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 1,
@PAddress = '762 Hayes St APT 18',
@AName = 'Bathroom',
@PZip = '98109'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 1,
@PAddress = '762 Hayes St APT 18',
@AName = 'Garage',
@PZip = '98109'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 1,
@PAddress = '762 Hayes St APT 18',
@AName = 'Dishwasher',
@PZip = '98109'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 1,
@PAddress = '762 Hayes St APT 18',
@AName = 'Radiant wall heating',
@PZip = '98109'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 2,
@PAddress = '6224 7th Ave NW',
@AName = 'Bedroom',
@PZip = '98107'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 1,
@PAddress = '6224 7th Ave NW',
@AName = 'Bathroom',
@PZip = '98107'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 1,
@PAddress = '6224 7th Ave NW',
@AName = 'Floor mounted air conditioner',
@PZip = '98107'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 1,
@PAddress = '6224 7th Ave NW',
@AName = 'Garage',
@PZip = '98107'
go
EXECUTE anthony_insert_Property_amenity
@Quant = 1,
@PAddress = '6224 7th Ave NW',
@AName = 'Dishwasher',
@PZip = '98107'
go
Exec dbo.anthony_insert_Property_amenity
2,
"1090 E Watertower St #150, Meridian, ID 83642",
"Bathroom",
"83642"
Go
Exec dbo.anthony_insert_Property_amenity
1,
"1090 E Watertower St #150, Meridian, ID 83642",
"Dishwasher",
"83642"
Go
Exec dbo.anthony_insert_Property_amenity
4,
"1090 E Watertower St #150, Meridian, ID 83642",
"Bedroom",
"83642"
Go
Exec dbo.anthony_insert_Property_amenity
1,
"201 Municipal Dr, Nampa, ID 83687",
"Lawn",
"83687"
Go
Exec dbo.anthony_insert_Property_amenity
1,
"201 Municipal Dr, Nampa, ID 83687",
"Bedroom",
"83687"
Go