Advertisement
Guest User

Untitled

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