View difference between Paste ID: BVWP4PMV and 8BG37Ec8
SHOW: | | - or go back to the newest paste.
1
2
3
/*
4
------------------------------------------
5
-- Create the SQL Scripts 
6
------------------------------------------
7
USE	SDS_KelsoSchoolDistrict_Staging_Wespac
8
GO
9
10
SELECT    'TRUNCATE TABLE ' + sysobjects.name 
11
FROM      sysobjects
12
WHERE     sysobjects.name LIKE 'IdMap%'
13
14
SELECT    'TRUNCATE TABLE ' + REPLACE(sysobjects.name, 'IdMap', '')
15
FROM      sysobjects
16
WHERE     sysobjects.name LIKE 'IdMap%'
17
ORDER BY sysobjects.name
18
*/
19
20
21
22
--USE	SDS_KelsoSchoolDistrict_Staging_Wespac
23
--USE	SDS_SheltonSchoolDistrict_Staging_Wespac
24
--USE SDS_IssaquahSchoolDistrict_Staging_Wespac
25
--USE SDS_BainbridgeIslandSchoolDistrict_Staging_Wespac
26
--USE SDS_YakimaSchoolDistrict_Staging_Wespac
27
USE SDS_NorthThurstonSchoolDistrict_Staging_Wespac
28
GO
29
30
31
TRUNCATE TABLE IdMapGuardians
32
TRUNCATE TABLE IdMapApplicationUserRoles
33
TRUNCATE TABLE IdMapStudentGradePointAverages
34
TRUNCATE TABLE IdMapGradePointAverageTypes
35
TRUNCATE TABLE IdMapStudentFoodserviceSubsidies
36
TRUNCATE TABLE IdMapAbsenceTypes
37
TRUNCATE TABLE IdMapStudentHandicappingConditions
38
TRUNCATE TABLE IdMapHandicappingConditions
39
TRUNCATE TABLE IdMapPhoneNumbers
40
TRUNCATE TABLE IdMapPersons_PhoneNumbers
41
TRUNCATE TABLE IdMapPersonSchoolDepartmentAssignments
42
TRUNCATE TABLE IdMapDisciplineActions
43
TRUNCATE TABLE IdMapPrincipalSchoolYears
44
TRUNCATE TABLE IdMapPrincipals
45
TRUNCATE TABLE IdMapClassTermDateRanges
46
TRUNCATE TABLE IdMapLanguages
47
TRUNCATE TABLE IdMapEntities_Addresses
48
TRUNCATE TABLE IdMapEntities
49
TRUNCATE TABLE IdMapAddresses
50
TRUNCATE TABLE IdMapTeacherSchoolYears
51
TRUNCATE TABLE IdMapStudentSchoolYears
52
TRUNCATE TABLE IdMapClassTermTypes
53
TRUNCATE TABLE IdMapPhoneNumberTypes
54
TRUNCATE TABLE IdMapFakePersons
55
TRUNCATE TABLE IdMapStudentDisciplineRecords
56
TRUNCATE TABLE IdMapDisciplineOffenses
57
TRUNCATE TABLE IdMapClassTeachingAssignments
58
TRUNCATE TABLE IdMapClasses
59
TRUNCATE TABLE IdMapPersons_Languages
60
TRUNCATE TABLE IdMapPersons_Ethnicities
61
TRUNCATE TABLE IdMapStudentClassEnrollments
62
TRUNCATE TABLE IdMapAutomatedLoginApplications
63
TRUNCATE TABLE IdMapStudentClassAttendanceRecords
64
TRUNCATE TABLE IdMapEntities_EmailAddresses
65
TRUNCATE TABLE IdMapEntities_PhoneNumbers
66
TRUNCATE TABLE IdMapPersons_Addresses
67
TRUNCATE TABLE IdMapStudentClassTermGrades
68
TRUNCATE TABLE IdMapClassAttendanceRecords
69
TRUNCATE TABLE IdMapEmployees
70
TRUNCATE TABLE IdMapGradeLevels
71
TRUNCATE TABLE IdMapActivities_SupervisoryPersons
72
TRUNCATE TABLE IdMapEmailAddressTypes
73
TRUNCATE TABLE IdMapSchoolDistricts
74
TRUNCATE TABLE IdMapAddressTypes
75
TRUNCATE TABLE IdMapStudents_HealthConditions
76
TRUNCATE TABLE IdMapSchoolYears
77
TRUNCATE TABLE IdMapSchoolTypes
78
TRUNCATE TABLE IdMapClassTerms
79
TRUNCATE TABLE IdMapClassTermSegments
80
TRUNCATE TABLE IdMapSchools
81
TRUNCATE TABLE IdMapActivities
82
TRUNCATE TABLE IdMapSkywardPersons
83
TRUNCATE TABLE IdMapPersons
84
TRUNCATE TABLE IdMapAbsenceReasons
85
TRUNCATE TABLE IdMapTeachers
86
TRUNCATE TABLE IdMapSchoolDepartments
87
TRUNCATE TABLE IdMapStudents_Activities
88
TRUNCATE TABLE IdMapStudents
89
TRUNCATE TABLE IdMapEthnicities
90
TRUNCATE TABLE IdMapGuardianTypes
91
TRUNCATE TABLE IdMapPersons_EmailAddresses
92
TRUNCATE TABLE IdMapEmailAddresses
93
TRUNCATE TABLE IdMapFoodServiceSubsidies
94
TRUNCATE TABLE IdMapStudentIllnessRecords
95
TRUNCATE TABLE IdMapHealthConditions
96
TRUNCATE TABLE IdMapStudentGuardianRelationships
97
98
99
100
101
--USE	SDS_KelsoSchoolDistrict
102
--USE	SDS_SheltonSchoolDistrict 
103
--USE SDS_IssaquahSchoolDistrict
104
--USE SDS_BainbridgeIslandSchoolDistrict
105
--USE SDS_YakimaSchoolDistrict
106
USE SDS_NorthThurstonSchoolDistrict
107
GO
108
109
110
111
-- Student Attendance, Absence, and reasons
112
TRUNCATE TABLE StudentClassAttendanceRecords
113
DELETE AbsenceReasons
114
DBCC CHECKIDENT ('AbsenceReasons', RESEED, 0)
115
DELETE AbsenceTypes
116
DBCC CHECKIDENT ('AbsenceTypes', RESEED, 0)
117
118
119
-- Student Activities
120
TRUNCATE TABLE Activities_SupervisoryPersons
121
TRUNCATE TABLE Students_Activities
122
DELETE Activities
123
DBCC CHECKIDENT ('Activities', RESEED, 0)
124
125
126
127
-- Student Health, handicapps, and Illness
128
TRUNCATE TABLE Students_HealthConditions
129
TRUNCATE TABLE StudentIllnessRecords
130
DELETE HealthConditions
131
DBCC CHECKIDENT ('HealthConditions', RESEED, 0)
132
TRUNCATE TABLE StudentHandicappingConditions
133
DELETE HandicappingConditions
134
DBCC CHECKIDENT ('HandicappingConditions', RESEED, 0)
135
136
137
138
139
140
-- Classes, Enrollments Assignment
141
TRUNCATE TABLE StudentClassTermGrades
142
DELETE StudentClassEnrollments
143
DBCC CHECKIDENT ('StudentClassEnrollments', RESEED, 0)
144
DELETE ClassAttendanceRecords
145
TRUNCATE TABLE ClassTeachingAssignments
146
DBCC CHECKIDENT ('ClassTeachingAssignments', RESEED, 0)
147
DELETE Classes
148
DBCC CHECKIDENT ('Classes', RESEED, 0)
149
150
151
152
153
154
155
-- Class Terms, Types, and Segments
156
TRUNCATE TABLE ClassTermDateRanges
157
DELETE ClassTermSegments	--DBCC CHECKIDENT ('ClassTermSegments', RESEED, 0)
158
DELETE ClassTerms			--DBCC CHECKIDENT ('ClassTerms', RESEED, 0)
159
DELETE ClassTermTypes		--DBCC CHECKIDENT ('ClassTermTypes', RESEED, 0)
160
161
162
TRUNCATE TABLE StudentFoodserviceSubsidies
163
DELETE FoodServiceSubsidies
164
DBCC CHECKIDENT ('FoodServiceSubsidies', RESEED, 0)
165
166
167
-- Student Discipline
168
TRUNCATE TABLE StudentDisciplineRecords
169
DELETE DisciplineActions
170
DBCC CHECKIDENT ('DisciplineActions', RESEED, 0)
171
DELETE DisciplineOffenses
172
173
174
175
176
-- Student Grade-Point averages
177
TRUNCATE TABLE StudentGradePointAverages
178
DELETE GradePointAverageTypes
179
DBCC CHECKIDENT ('GradePointAverageTypes', RESEED, 0)
180
181
182
-- School District Departments
183
TRUNCATE TABLE PersonSchoolDepartmentAssignments
184
DELETE SchoolDepartments
185
DBCC CHECKIDENT ('SchoolDepartments', RESEED, 0)
186
DELETE SchoolDistricts	--DBCC CHECKIDENT ('SchoolDistricts', RESEED, 0)
187
188
189
190
191
192
193
194
195
-- Role/School year augmented association records
196
DELETE PrincipalSchoolYears
197
DELETE StudentSchoolYears
198
DELETE TeacherSchoolYears
199
200
201
-- Schools, Types, and School Years
202
DELETE Schools
203
DBCC CHECKIDENT ('Schools', RESEED, 0)
204
DELETE SchoolTypes	--DBCC CHECKIDENT ('SchoolTypes', RESEED, 0)
205
DELETE SchoolYears	--DBCC CHECKIDENT ('SchoolYears', RESEED, 0)
206
207
208
209
-- Roles
210
TRUNCATE TABLE StudentGuardianRelationships
211
TRUNCATE TABLE SkywardPersons
212
TRUNCATE TABLE Employees	
213
DELETE Principals	--DBCC CHECKIDENT ('Principals', RESEED, 0)
214
DELETE Teachers		--DBCC CHECKIDENT ('Teachers', RESEED, 0)
215
DELETE Students		--DBCC CHECKIDENT ('Students', RESEED, 0)
216
DELETE Guardians	--DBCC CHECKIDENT ('Guardians', RESEED, 0)
217
DELETE GuardianTypes
218
DBCC CHECKIDENT ('GuardianTypes', RESEED, 0)
219
220
221
222
223
224
225
226
227
228
-- Contact info association records
229
TRUNCATE TABLE Persons_Addresses
230
TRUNCATE TABLE Entities_Addresses
231
TRUNCATE TABLE Entities_EmailAddresses
232
TRUNCATE TABLE Entities_PhoneNumbers
233
TRUNCATE TABLE Entities_Addresses
234
TRUNCATE TABLE Persons_EmailAddresses
235
TRUNCATE TABLE Persons_Ethnicities
236
TRUNCATE TABLE Persons_Languages
237
TRUNCATE TABLE Persons_PhoneNumbers
238
239
240
241
-- Languages, Ethnicities and Subsidies
242
DELETE Languages
243
DBCC CHECKIDENT ('Languages', RESEED, 0)
244
DELETE Ethnicities
245
DBCC CHECKIDENT ('Ethnicities', RESEED, 0)
246
247
248
249
-- Automated Logins and Application Users
250
TRUNCATE TABLE AutomatedLoginAccounts
251
DELETE AutomatedLoginApplications	--DBCC CHECKIDENT ('AutomatedLoginApplications', RESEED, 0)
252
TRUNCATE TABLE ApplicationUsers_Roles
253
DELETE ApplicationUsers
254
DBCC CHECKIDENT ('ApplicationUsers', RESEED, 0)
255
256
257
258
-- Contact info records
259
DELETE EmailAddresses
260
DBCC CHECKIDENT ('EmailAddresses', RESEED, 0)
261
DELETE PhoneNumbers
262
DBCC CHECKIDENT ('PhoneNumbers', RESEED, 0)
263
DELETE Addresses
264
DBCC CHECKIDENT ('Addresses', RESEED, 0)
265
266
267
268
269
DELETE Persons
270
DBCC CHECKIDENT ('Persons', RESEED, 0)
271
272
DELETE Entities
273
DBCC CHECKIDENT ('Entities', RESEED, 0)