Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1363 lines
65 KiB

  1. -- Script: uddi.v2.migrate.v15.v2.sql
  2. -- Author: [email protected]
  3. -- Date: 04-10-01
  4. -- Description: Migrates data from v16 to v2.0.
  5. -- Instructions:
  6. -- 1. Restore a copy of the v15 database on the same machine as the target v2.0 database
  7. -- 2. Edit the database names in line 12 (target), line 31 (source) and line 32 (target) to reflect current environment
  8. -- 3. Execute this script
  9. -- 4. Save the results for verification
  10. -- =============================================
  11. -- Name: ADM_migrate
  12. -- =============================================
  13. IF EXISTS (SELECT name FROM sysobjects WHERE name = 'ADM_migrate' AND type = 'P')
  14. DROP PROCEDURE ADM_migrate
  15. GO
  16. CREATE PROCEDURE ADM_migrate
  17. @sourceDb sysname,
  18. @destDb sysname,
  19. @mode varchar(20)
  20. WITH ENCRYPTION
  21. AS
  22. BEGIN
  23. DECLARE
  24. @message varchar(8000),
  25. @batchText varchar(8000),
  26. @lf char(1),
  27. @start datetime,
  28. @stop datetime,
  29. @duration datetime,
  30. @rows int
  31. SET @lf = CHAR(10)
  32. SET @start = getdate()
  33. --
  34. -- Delete build data
  35. --
  36. SET @message=REPLICATE('=',80)
  37. PRINT @message
  38. PRINT 'Deleting data in target database...'
  39. -- Delete all tModel data
  40. TRUNCATE TABLE [UDC_categoryBag_TM]
  41. TRUNCATE TABLE [UDC_identifierBag_TM]
  42. TRUNCATE TABLE [UDC_tModelDesc]
  43. DELETE [UDC_tModels]
  44. -- Delete all bindingTemplate data
  45. TRUNCATE TABLE [UDC_instanceDesc]
  46. DELETE [UDC_tModelInstances]
  47. TRUNCATE TABLE [UDC_bindingDesc]
  48. DELETE [UDC_bindingTemplates]
  49. -- Delete all businessService data
  50. TRUNCATE TABLE [UDC_names_BS]
  51. TRUNCATE TABLE [UDC_categoryBag_BS]
  52. TRUNCATE TABLE [UDC_serviceDesc]
  53. DELETE [UDC_businessServices]
  54. -- Delete all businessEntity data
  55. TRUNCATE TABLE [UDC_addressLines]
  56. DELETE [UDC_addresses]
  57. TRUNCATE TABLE [UDC_phones]
  58. TRUNCATE TABLE [UDC_emails]
  59. TRUNCATE TABLE [UDC_contactDesc]
  60. DELETE [UDC_contacts]
  61. TRUNCATE TABLE [UDC_businessDesc]
  62. TRUNCATE TABLE [UDC_categoryBag_BE]
  63. TRUNCATE TABLE [UDC_identifierBag_BE]
  64. TRUNCATE TABLE [UDC_discoveryURLs]
  65. TRUNCATE TABLE [UDC_names_BE]
  66. DELETE [UDC_businessEntities]
  67. TRUNCATE TABLE [UDC_assertions_BE]
  68. TRUNCATE TABLE [UDC_serviceProjections]
  69. -- Miscellaneous deletes
  70. TRUNCATE TABLE [UDO_changeLog]
  71. DELETE [UDO_operators]
  72. DELETE [UDO_publishers]
  73. SET @message=REPLICATE('=',80)
  74. PRINT @message
  75. --
  76. -- Migrate UDO_publishers
  77. --
  78. SET @batchText = ''
  79. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  80. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDO_publishers] ' + @lf
  81. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDO_publishers].''' + @lf
  82. SET @batchText = @batchText + 'PRINT @message ' + @lf
  83. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDO_publishers] ON ' + @lf
  84. SET @batchText = @batchText + 'INSERT [UDO_publishers] ( ' + @lf
  85. SET @batchText = @batchText + ' [publisherID], [publisherStatusID], [PUID], [email], [name], [phone], [isoLangCode], [tModelLimit], [businessLimit], [serviceLimit], [bindingLimit], [companyName], [addressLine1], [addressLine2], [mailstop], [city], [stateProvince], [extraProvince], [country], [postalCode], [companyURL], [companyPhone], [altPhone], [backupContact], [backupEmail], [description], [securityToken], [flag]) ' + @lf
  86. SET @batchText = @batchText + 'SELECT ' + @lf
  87. SET @batchText = @batchText + ' [publisherID], [publisherStatusID] - 1, [PUID], [email], [name], [phone], [isoLangCode], [tModelLimit], [businessLimit], [serviceLimit], [bindingLimit], [companyName], [addressLine1], [addressLine2], [mailstop], [city], [stateProvince], [extraProvince], [country], [postalCode], [companyURL], [companyPhone], [altPhone], [backupContact], [backupEmail], [description], [securityToken], [flag] ' + @lf
  88. SET @batchText = @batchText + 'FROM ' + @lf
  89. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDO_publishers] ' + @lf
  90. SET @batchText = @batchText + 'ORDER BY ' + @lf
  91. SET @batchText = @batchText + ' [publisherID] ' + @lf
  92. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  93. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDO_publishers.''' + @lf
  94. SET @batchText = @batchText + 'PRINT @message ' + @lf
  95. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDO_publishers] OFF ' + @lf
  96. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDO_publishers] ' + @lf
  97. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDO_publishers.''' + @lf
  98. SET @batchText = @batchText + 'PRINT @message ' + @lf
  99. SET @message=REPLICATE('=',80)
  100. PRINT @message
  101. PRINT 'Migrate UDO_publishers to UDO_publishers: '
  102. SET @message=REPLICATE('-',80)
  103. PRINT @message
  104. PRINT @batchText
  105. SET @message=REPLICATE('-',80)
  106. PRINT @message
  107. PRINT 'Results: '
  108. SET @message=REPLICATE('-',80)
  109. PRINT @message
  110. EXEC (@batchText)
  111. SET @message=REPLICATE('=',80)
  112. PRINT @message
  113. --
  114. -- Migrate UDO_operators to UDO_operators
  115. --
  116. SET @batchText = ''
  117. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  118. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDO_operators] ' + @lf
  119. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDO_operators].''' + @lf
  120. SET @batchText = @batchText + 'PRINT @message ' + @lf
  121. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDO_operators] ON ' + @lf
  122. SET @batchText = @batchText + 'INSERT [UDO_operators] ( ' + @lf
  123. SET @batchText = @batchText + ' [operatorID], [operatorKey], [publisherID], [operatorStatusID], [name], [soapReplicationURL], [certSerialNo], [certIssuer], [certSubject], [certificate], [flag]) ' + @lf
  124. SET @batchText = @batchText + 'SELECT ' + @lf
  125. SET @batchText = @batchText + ' [operatorID], NEWID(), [publisherID], 1, [name], ''not initialized'', NEWID(), ''not initialized'', ''not initialized'', NULL, 0 ' + @lf
  126. SET @batchText = @batchText + 'FROM ' + @lf
  127. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDO_operators] ' + @lf
  128. SET @batchText = @batchText + 'ORDER BY ' + @lf
  129. SET @batchText = @batchText + ' [operatorID] ' + @lf
  130. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  131. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDO_operators.''' + @lf
  132. SET @batchText = @batchText + 'PRINT @message ' + @lf
  133. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDO_publishers] OFF ' + @lf
  134. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDO_operators] ' + @lf
  135. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDO_operators.''' + @lf
  136. SET @batchText = @batchText + 'PRINT @message ' + @lf
  137. SET @message=REPLICATE('=',80)
  138. PRINT @message
  139. PRINT 'Migrate UDC_operators to UDO_operators: '
  140. SET @message=REPLICATE('-',80)
  141. PRINT @message
  142. PRINT @batchText
  143. SET @message=REPLICATE('-',80)
  144. PRINT @message
  145. PRINT 'Results: '
  146. SET @message=REPLICATE('-',80)
  147. PRINT @message
  148. EXEC (@batchText)
  149. SET @message=REPLICATE('=',80)
  150. PRINT @message
  151. --
  152. -- Fix up UDO_operators
  153. --
  154. SET @batchText = ''
  155. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  156. SET @batchText = @batchText + 'UPDATE [UDO_operators] SET ' + @lf
  157. SET @batchText = @batchText + ' [operatorKey] = ''A05CF23A-296F-4899-B204-7142F31A77F9'', ' + @lf
  158. SET @batchText = @batchText + ' [operatorStatusID] = 3 ' + @lf
  159. SET @batchText = @batchText + 'WHERE ' + @lf
  160. SET @batchText = @batchText + ' ([operatorID] = 1) ' + @lf
  161. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  162. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows updated in UDO_operators for Ariba.''' + @lf
  163. SET @batchText = @batchText + 'PRINT @message ' + @lf
  164. SET @batchText = @batchText + 'UPDATE [UDO_operators] SET ' + @lf
  165. SET @batchText = @batchText + ' [operatorKey] = ''A34875A8-A8DB-4231-BD12-1D5F1DC70EBF'' ' + @lf
  166. SET @batchText = @batchText + 'WHERE ' + @lf
  167. SET @batchText = @batchText + ' ([operatorID] = 2) ' + @lf
  168. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  169. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows updated in UDO_operators for IBM.''' + @lf
  170. SET @batchText = @batchText + 'PRINT @message ' + @lf
  171. SET @batchText = @batchText + 'UPDATE [UDO_operators] SET ' + @lf
  172. SET @batchText = @batchText + ' [operatorKey] = ''C8DE6FD6-4068-4FE2-B1DA-3C7E66EA9568'' ' + @lf
  173. SET @batchText = @batchText + 'WHERE ' + @lf
  174. SET @batchText = @batchText + ' ([operatorID] = 3) ' + @lf
  175. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  176. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows updated in UDO_operators for Microsoft.''' + @lf
  177. SET @batchText = @batchText + 'PRINT @message ' + @lf
  178. SET @message=REPLICATE('=',80)
  179. PRINT @message
  180. PRINT 'Fix up UDO_operators: '
  181. SET @message=REPLICATE('-',80)
  182. PRINT @message
  183. PRINT @batchText
  184. SET @message=REPLICATE('-',80)
  185. PRINT @message
  186. PRINT 'Results: '
  187. SET @message=REPLICATE('-',80)
  188. PRINT @message
  189. EXEC (@batchText)
  190. SET @message=REPLICATE('=',80)
  191. PRINT @message
  192. --
  193. -- Migrate UDC_tModels to UDC_tModels
  194. --
  195. SET @batchText = ''
  196. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  197. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_tModels] ' + @lf
  198. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_tModels].''' + @lf
  199. SET @batchText = @batchText + 'PRINT @message ' + @lf
  200. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_tModels] ON ' + @lf
  201. SET @batchText = @batchText + 'INSERT [UDC_tModels]( ' + @lf
  202. SET @batchText = @batchText + ' [tModelID], [publisherID], [generic], [authorizedName], [tModelKey], [name], [overviewURL], [lastChange], [flag]) ' + @lf
  203. SET @batchText = @batchText + 'SELECT ' + @lf
  204. SET @batchText = @batchText + ' [tModelID], [publisherID], [generic], [authorizedName], [tModelKey], [name], [overviewURL], 0, [flag] ' + @lf
  205. SET @batchText = @batchText + 'FROM ' + @lf
  206. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_tModels] ' + @lf
  207. SET @batchText = @batchText + 'ORDER BY ' + @lf
  208. SET @batchText = @batchText + ' [tModelID] ' + @lf
  209. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  210. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_tModels.''' + @lf
  211. SET @batchText = @batchText + 'PRINT @message ' + @lf
  212. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_tModels] OFF ' + @lf
  213. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_tModels] ' + @lf
  214. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_tModels.''' + @lf
  215. SET @batchText = @batchText + 'PRINT @message ' + @lf
  216. SET @message=REPLICATE('=',80)
  217. PRINT @message
  218. PRINT 'UDC_tModels to UDC_tModels'
  219. SET @message=REPLICATE('-',80)
  220. PRINT @message
  221. PRINT @batchText
  222. SET @message=REPLICATE('-',80)
  223. PRINT @message
  224. PRINT 'Results: '
  225. SET @message=REPLICATE('-',80)
  226. PRINT @message
  227. EXEC (@batchText)
  228. SET @message=REPLICATE('=',80)
  229. PRINT @message
  230. --
  231. -- Migrate UDC_tModelDesc to UDC_tModelDesc
  232. --
  233. SET @batchText = ''
  234. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  235. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_tModelDesc] ' + @lf
  236. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_tModelDesc].''' + @lf
  237. SET @batchText = @batchText + 'PRINT @message ' + @lf
  238. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_tModelDesc] ON ' + @lf
  239. SET @batchText = @batchText + 'INSERT [UDC_tModelDesc]( ' + @lf
  240. SET @batchText = @batchText + ' [tModelID], [seqNo], [elementID], [isoLangCode], [description], [flag])' + @lf
  241. SET @batchText = @batchText + 'SELECT ' + @lf
  242. SET @batchText = @batchText + ' [tModelID], [seqNo], [elementID] - 1, [isoLangCode], [description], [flag] ' + @lf
  243. SET @batchText = @batchText + 'FROM ' + @lf
  244. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_tModelDesc] ' + @lf
  245. SET @batchText = @batchText + 'ORDER BY ' + @lf
  246. SET @batchText = @batchText + ' [tModelID], [seqNo] ' + @lf
  247. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  248. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_tModelDesc.''' + @lf
  249. SET @batchText = @batchText + 'PRINT @message ' + @lf
  250. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_tModelDesc] OFF ' + @lf
  251. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_tModelDesc] ' + @lf
  252. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_tModelDesc.''' + @lf
  253. SET @batchText = @batchText + 'PRINT @message ' + @lf
  254. SET @message=REPLICATE('=',80)
  255. PRINT @message
  256. PRINT 'UDC_tModelDesc to UDC_tModelDesc'
  257. SET @message=REPLICATE('-',80)
  258. PRINT @message
  259. PRINT @batchText
  260. SET @message=REPLICATE('-',80)
  261. PRINT @message
  262. PRINT 'Results: '
  263. SET @message=REPLICATE('-',80)
  264. PRINT @message
  265. EXEC (@batchText)
  266. SET @message=REPLICATE('=',80)
  267. PRINT @message
  268. --
  269. -- Migrate UDC_identifierBag_TM to UDC_identifierBag_TM
  270. --
  271. SET @batchText = ''
  272. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  273. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_identifierBag_TM] ' + @lf
  274. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_identifierBag_TM].''' + @lf
  275. SET @batchText = @batchText + 'PRINT @message ' + @lf
  276. SET @batchText = @batchText + 'INSERT [UDC_identifierBag_TM]( ' + @lf
  277. SET @batchText = @batchText + ' [tModelID], [keyName], [keyValue], [tModelKey], [flag])' + @lf
  278. SET @batchText = @batchText + 'SELECT ' + @lf
  279. SET @batchText = @batchText + ' [tModelID], [keyName], [keyValue], [tModelKey], [flag] ' + @lf
  280. SET @batchText = @batchText + 'FROM ' + @lf
  281. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_identifierBag_TM] ' + @lf
  282. SET @batchText = @batchText + 'ORDER BY ' + @lf
  283. SET @batchText = @batchText + ' [seqNo] ' + @lf
  284. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  285. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_identifierBag_TM.''' + @lf
  286. SET @batchText = @batchText + 'PRINT @message ' + @lf
  287. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_identifierBag_TM] ' + @lf
  288. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_identifierBag_TM.''' + @lf
  289. SET @batchText = @batchText + 'PRINT @message ' + @lf
  290. SET @message=REPLICATE('=',80)
  291. PRINT @message
  292. PRINT 'Migrate UDC_identifierBag_TM to UDC_identifierBag_TM'
  293. SET @message=REPLICATE('-',80)
  294. PRINT @message
  295. PRINT @batchText
  296. SET @message=REPLICATE('-',80)
  297. PRINT @message
  298. PRINT 'Results: '
  299. SET @message=REPLICATE('-',80)
  300. PRINT @message
  301. EXEC (@batchText)
  302. SET @message=REPLICATE('=',80)
  303. PRINT @message
  304. --
  305. -- Migrate UDC_categoryBag_TM TO UDC_categoryBag_TM
  306. --
  307. SET @batchText = ''
  308. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  309. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_categoryBag_TM] ' + @lf
  310. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' tModel rows in [' + @sourceDb + ']..[UDC_categoryBag_TM].''' + @lf
  311. SET @batchText = @batchText + 'PRINT @message ' + @lf
  312. SET @batchText = @batchText + 'INSERT [UDC_categoryBag_TM]( ' + @lf
  313. SET @batchText = @batchText + ' [tModelID], [keyName], [keyValue], [tModelKey], [flag]) ' + @lf
  314. SET @batchText = @batchText + 'SELECT ' + @lf
  315. SET @batchText = @batchText + ' [tModelID], [keyName], [keyValue], [tModelKey], [flag] ' + @lf
  316. SET @batchText = @batchText + 'FROM ' + @lf
  317. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_categoryBag_TM] ' + @lf
  318. SET @batchText = @batchText + 'ORDER BY ' + @lf
  319. SET @batchText = @batchText + ' [seqNo] ' + @lf
  320. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  321. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_categoryBag_TM.''' + @lf
  322. SET @batchText = @batchText + 'PRINT @message ' + @lf
  323. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_categoryBag_TM] ' + @lf
  324. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_categoryBag_TM.''' + @lf
  325. SET @batchText = @batchText + 'PRINT @message ' + @lf
  326. SET @message=REPLICATE('=',80)
  327. PRINT @message
  328. PRINT 'Migrate UDC_categoryBag_TM TO UDC_categoryBag_TM'
  329. SET @message=REPLICATE('-',80)
  330. PRINT @message
  331. PRINT @batchText
  332. SET @message=REPLICATE('-',80)
  333. PRINT @message
  334. PRINT 'Results: '
  335. SET @message=REPLICATE('-',80)
  336. PRINT @message
  337. EXEC (@batchText)
  338. SET @message=REPLICATE('=',80)
  339. PRINT @message
  340. --
  341. -- Migrate UDC_businessEntities to UDC_businessEntities
  342. --
  343. SET @batchText = ''
  344. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  345. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_businessEntities] ' + @lf
  346. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_businessEntities].''' + @lf
  347. SET @batchText = @batchText + 'PRINT @message ' + @lf
  348. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_businessEntities] ON ' + @lf
  349. SET @batchText = @batchText + 'INSERT INTO [UDC_businessEntities]( ' + @lf
  350. SET @batchText = @batchText + ' [businessID], [publisherID], [generic], [authorizedName], [businessKey], [lastChange], [flag]) ' + @lf
  351. SET @batchText = @batchText + 'SELECT ' + @lf
  352. SET @batchText = @batchText + ' [businessID], [publisherID], [generic], [authorizedName], [businessKey], 0, [flag] ' + @lf
  353. SET @batchText = @batchText + 'FROM ' + @lf
  354. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_businessEntities] ' + @lf
  355. SET @batchText = @batchText + 'ORDER BY ' + @lf
  356. SET @batchText = @batchText + ' [businessID] ' + @lf
  357. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  358. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_businessEntities.''' + @lf
  359. SET @batchText = @batchText + 'PRINT @message ' + @lf
  360. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_businessEntities] OFF ' + @lf
  361. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_businessEntities] ' + @lf
  362. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_businessEntities.''' + @lf
  363. SET @batchText = @batchText + 'PRINT @message ' + @lf
  364. SET @message=REPLICATE('=',80)
  365. PRINT @message
  366. PRINT 'UDC_businessEntities to UDC_businessEntities'
  367. SET @message=REPLICATE('-',80)
  368. PRINT @message
  369. PRINT @batchText
  370. SET @message=REPLICATE('-',80)
  371. PRINT @message
  372. PRINT 'Results: '
  373. SET @message=REPLICATE('-',80)
  374. PRINT @message
  375. EXEC (@batchText)
  376. SET @message=REPLICATE('=',80)
  377. PRINT @message
  378. --
  379. -- Migrate UDC_businessEntities to UDC_names_BE
  380. --
  381. SET @batchText = ''
  382. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  383. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_businessEntities] ' + @lf
  384. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_businessEntities].''' + @lf
  385. SET @batchText = @batchText + 'PRINT @message ' + @lf
  386. SET @batchText = @batchText + 'INSERT INTO [UDC_names_BE]( ' + @lf
  387. SET @batchText = @batchText + ' [businessID], [isoLangCode], [name]) ' + @lf
  388. SET @batchText = @batchText + 'SELECT ' + @lf
  389. SET @batchText = @batchText + ' BE.[businessID], PU.[isoLangCode], BE.[name] ' + @lf
  390. SET @batchText = @batchText + 'FROM ' + @lf
  391. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_businessEntities] BE ' + @lf
  392. SET @batchText = @batchText + ' JOIN [' + @sourceDb + ']..[UDO_publishers] PU ON BE.[publisherID] = PU.[publisherID] ' + @lf
  393. SET @batchText = @batchText + 'ORDER BY ' + @lf
  394. SET @batchText = @batchText + ' BE.[businessID] ' + @lf
  395. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  396. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_names_BE.''' + @lf
  397. SET @batchText = @batchText + 'PRINT @message ' + @lf
  398. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_names_BE] ' + @lf
  399. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_names_BE.''' + @lf
  400. SET @batchText = @batchText + 'PRINT @message ' + @lf
  401. SET @message=REPLICATE('=',80)
  402. PRINT @message
  403. PRINT 'Migrate UDC_businessEntities to UDC_names_BE'
  404. SET @message=REPLICATE('-',80)
  405. PRINT @message
  406. PRINT @batchText
  407. SET @message=REPLICATE('-',80)
  408. PRINT @message
  409. PRINT 'Results: '
  410. SET @message=REPLICATE('-',80)
  411. PRINT @message
  412. EXEC (@batchText)
  413. SET @message=REPLICATE('=',80)
  414. PRINT @message
  415. --
  416. -- Migrate UDC_businessDesc to UDC_businessDesc
  417. --
  418. SET @batchText = ''
  419. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  420. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_businessDesc] ' + @lf
  421. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_businessDesc].''' + @lf
  422. SET @batchText = @batchText + 'PRINT @message ' + @lf
  423. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_businessDesc] ON ' + @lf
  424. SET @batchText = @batchText + 'INSERT INTO [UDC_businessDesc]( ' + @lf
  425. SET @batchText = @batchText + ' [businessID], [seqNo], [isoLangCode], [description], [flag])' + @lf
  426. SET @batchText = @batchText + 'SELECT ' + @lf
  427. SET @batchText = @batchText + ' [businessID], [seqNo], [isoLangCode], [description], [flag] ' + @lf
  428. SET @batchText = @batchText + 'FROM ' + @lf
  429. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_businessDesc] ' + @lf
  430. SET @batchText = @batchText + 'ORDER BY ' + @lf
  431. SET @batchText = @batchText + ' [businessID], [seqNo] ' + @lf
  432. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  433. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_businessDesc.''' + @lf
  434. SET @batchText = @batchText + 'PRINT @message ' + @lf
  435. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_businessDesc] OFF ' + @lf
  436. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_businessDesc] ' + @lf
  437. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_businessDesc.''' + @lf
  438. SET @batchText = @batchText + 'PRINT @message ' + @lf
  439. SET @message=REPLICATE('=',80)
  440. PRINT @message
  441. PRINT 'UDC_businessDesc to UDC_businessDesc'
  442. SET @message=REPLICATE('-',80)
  443. PRINT @message
  444. PRINT @batchText
  445. SET @message=REPLICATE('-',80)
  446. PRINT @message
  447. PRINT 'Results: '
  448. SET @message=REPLICATE('-',80)
  449. PRINT @message
  450. EXEC (@batchText)
  451. SET @message=REPLICATE('=',80)
  452. PRINT @message
  453. --
  454. -- Migrate UDC_discoveryURLs to UDC_discoveryURLs
  455. --
  456. SET @batchText = ''
  457. SET @batchText = @batchText + '' + @lf
  458. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  459. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_discoveryURLs] ' + @lf
  460. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_discoveryURLs].''' + @lf
  461. SET @batchText = @batchText + 'PRINT @message ' + @lf
  462. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_discoveryURLs] ON ' + @lf
  463. SET @batchText = @batchText + 'INSERT INTO [UDC_discoveryURLs]( ' + @lf
  464. SET @batchText = @batchText + ' [businessID], [seqNo], [useType], [discoveryURL], [flag]) ' + @lf
  465. SET @batchText = @batchText + 'SELECT ' + @lf
  466. SET @batchText = @batchText + ' [businessID], [seqNo], [useType], [discoveryURL], [flag] ' + @lf
  467. SET @batchText = @batchText + 'FROM ' + @lf
  468. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_discoveryURLs] ' + @lf
  469. SET @batchText = @batchText + 'ORDER BY ' + @lf
  470. SET @batchText = @batchText + ' [businessID], [seqNo] ' + @lf
  471. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  472. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_discoveryURLs.''' + @lf
  473. SET @batchText = @batchText + 'PRINT @message ' + @lf
  474. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_discoveryURLs] OFF ' + @lf
  475. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_discoveryURLs] ' + @lf
  476. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_discoveryURLs.''' + @lf
  477. SET @batchText = @batchText + 'PRINT @message ' + @lf
  478. SET @message=REPLICATE('=',80)
  479. PRINT @message
  480. PRINT 'UDC_discoveryURLs to UDC_discoveryURLs'
  481. SET @message=REPLICATE('-',80)
  482. PRINT @message
  483. PRINT @batchText
  484. SET @message=REPLICATE('-',80)
  485. PRINT @message
  486. PRINT 'Results: '
  487. SET @message=REPLICATE('-',80)
  488. PRINT @message
  489. EXEC (@batchText)
  490. SET @message=REPLICATE('=',80)
  491. PRINT @message
  492. --
  493. -- Migrate UDC_identifierBag_BE to UDC_identifierBag_BE
  494. --
  495. SET @batchText = ''
  496. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  497. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_identifierBag_BE] ' + @lf
  498. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' businessEntity rows in [' + @sourceDb + ']..[UDC_identifierBag_BE].''' + @lf
  499. SET @batchText = @batchText + 'PRINT @message ' + @lf
  500. SET @batchText = @batchText + 'INSERT [UDC_identifierBag_BE]( ' + @lf
  501. SET @batchText = @batchText + ' [businessID], [keyName], [keyValue], [tModelKey], [flag]) ' + @lf
  502. SET @batchText = @batchText + 'SELECT ' + @lf
  503. SET @batchText = @batchText + ' [businessID], [keyName], [keyValue], [tModelKey], [flag] ' + @lf
  504. SET @batchText = @batchText + 'FROM ' + @lf
  505. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_identifierBag_BE] ' + @lf
  506. SET @batchText = @batchText + 'ORDER BY ' + @lf
  507. SET @batchText = @batchText + ' [seqNo] ' + @lf
  508. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  509. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_identifierBag_BE.''' + @lf
  510. SET @batchText = @batchText + 'PRINT @message ' + @lf
  511. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_identifierBag_BE] ' + @lf
  512. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_identifierBag_BE.''' + @lf
  513. SET @batchText = @batchText + 'PRINT @message ' + @lf
  514. SET @message=REPLICATE('=',80)
  515. PRINT @message
  516. PRINT 'Migrate UDC_identifierBag_BE to UDC_identifierBag_BE'
  517. SET @message=REPLICATE('-',80)
  518. PRINT @message
  519. PRINT @batchText
  520. SET @message=REPLICATE('-',80)
  521. PRINT @message
  522. PRINT 'Results: '
  523. SET @message=REPLICATE('-',80)
  524. PRINT @message
  525. EXEC (@batchText)
  526. SET @message=REPLICATE('=',80)
  527. PRINT @message
  528. --
  529. -- Migrate UDC_categoryBag_BE TO UDC_categoryBag_BE
  530. --
  531. SET @batchText = ''
  532. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  533. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_categoryBag_BE] ' + @lf
  534. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' businessEntity rows in [' + @sourceDb + ']..[UDC_categoryBag_BE].''' + @lf
  535. SET @batchText = @batchText + 'PRINT @message ' + @lf
  536. SET @batchText = @batchText + 'INSERT [UDC_categoryBag_BE]( ' + @lf
  537. SET @batchText = @batchText + ' [businessID], [keyName], [keyValue], [tModelKey], [flag]) ' + @lf
  538. SET @batchText = @batchText + 'SELECT ' + @lf
  539. SET @batchText = @batchText + ' [businessID], [keyName], [keyValue], [tModelKey], [flag] ' + @lf
  540. SET @batchText = @batchText + 'FROM ' + @lf
  541. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_categoryBag_BE] ' + @lf
  542. SET @batchText = @batchText + 'ORDER BY ' + @lf
  543. SET @batchText = @batchText + ' [seqNo] ' + @lf
  544. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  545. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_categoryBag_BE.''' + @lf
  546. SET @batchText = @batchText + 'PRINT @message ' + @lf
  547. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_categoryBag_BE] ' + @lf
  548. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_categoryBag_BE.''' + @lf
  549. SET @batchText = @batchText + 'PRINT @message ' + @lf
  550. SET @message=REPLICATE('=',80)
  551. PRINT @message
  552. PRINT 'UDC_categoryBag_BE TO UDC_categoryBag_BE'
  553. SET @message=REPLICATE('-',80)
  554. PRINT @message
  555. PRINT @batchText
  556. SET @message=REPLICATE('-',80)
  557. PRINT @message
  558. PRINT 'Results: '
  559. SET @message=REPLICATE('-',80)
  560. PRINT @message
  561. EXEC (@batchText)
  562. SET @message=REPLICATE('=',80)
  563. PRINT @message
  564. --
  565. -- Migrate UDC_contacts to UDC_contacts
  566. --
  567. SET @batchText = ''
  568. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  569. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_contacts] ' + @lf
  570. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_contacts].''' + @lf
  571. SET @batchText = @batchText + 'PRINT @message ' + @lf
  572. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_contacts] ON ' + @lf
  573. SET @batchText = @batchText + 'INSERT INTO [UDC_contacts]( ' + @lf
  574. SET @batchText = @batchText + ' [contactID], [businessID], [useType], [personName], [flag]) ' + @lf
  575. SET @batchText = @batchText + 'SELECT ' + @lf
  576. SET @batchText = @batchText + ' [contactID], [businessID], [useType], [personName], [flag] ' + @lf
  577. SET @batchText = @batchText + 'FROM ' + @lf
  578. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_contacts] ' + @lf
  579. SET @batchText = @batchText + 'ORDER BY ' + @lf
  580. SET @batchText = @batchText + ' [contactID] ' + @lf
  581. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  582. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_contacts.''' + @lf
  583. SET @batchText = @batchText + 'PRINT @message ' + @lf
  584. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_contacts] OFF ' + @lf
  585. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_contacts] ' + @lf
  586. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_contacts.''' + @lf
  587. SET @batchText = @batchText + 'PRINT @message ' + @lf
  588. SET @message=REPLICATE('=',80)
  589. PRINT @message
  590. PRINT 'UDC_contacts to UDC_contacts'
  591. SET @message=REPLICATE('-',80)
  592. PRINT @message
  593. PRINT @batchText
  594. SET @message=REPLICATE('-',80)
  595. PRINT @message
  596. PRINT 'Results: '
  597. SET @message=REPLICATE('-',80)
  598. PRINT @message
  599. EXEC (@batchText)
  600. SET @message=REPLICATE('=',80)
  601. PRINT @message
  602. --
  603. -- Migrate UDC_contactDesc to UDC_contactDesc
  604. --
  605. SET @batchText = ''
  606. SET @batchText = @batchText + '' + @lf
  607. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  608. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_contactDesc] ' + @lf
  609. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_contactDesc].''' + @lf
  610. SET @batchText = @batchText + 'PRINT @message ' + @lf
  611. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_contactDesc] ON ' + @lf
  612. SET @batchText = @batchText + 'INSERT INTO [UDC_contactDesc]( ' + @lf
  613. SET @batchText = @batchText + ' [contactID], [seqNo], [isoLangCode], [description], [flag]) ' + @lf
  614. SET @batchText = @batchText + 'SELECT ' + @lf
  615. SET @batchText = @batchText + ' [contactID], [seqNo], [isoLangCode], [description], [flag] ' + @lf
  616. SET @batchText = @batchText + 'FROM ' + @lf
  617. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_contactDesc] ' + @lf
  618. SET @batchText = @batchText + 'ORDER BY ' + @lf
  619. SET @batchText = @batchText + ' [contactID], [seqNo] ' + @lf
  620. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  621. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_contactDesc.''' + @lf
  622. SET @batchText = @batchText + 'PRINT @message ' + @lf
  623. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_contactDesc] OFF ' + @lf
  624. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_contactDesc] ' + @lf
  625. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_contactDesc.''' + @lf
  626. SET @batchText = @batchText + 'PRINT @message ' + @lf
  627. SET @message=REPLICATE('=',80)
  628. PRINT @message
  629. PRINT 'UDC_contactDesc to UDC_contactDesc'
  630. SET @message=REPLICATE('-',80)
  631. PRINT @message
  632. PRINT @batchText
  633. SET @message=REPLICATE('-',80)
  634. PRINT @message
  635. PRINT 'Results: '
  636. SET @message=REPLICATE('-',80)
  637. PRINT @message
  638. EXEC (@batchText)
  639. SET @message=REPLICATE('=',80)
  640. PRINT @message
  641. --
  642. -- Migrate UDC_emails to UDC_emails
  643. --
  644. SET @batchText = ''
  645. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  646. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_emails] ' + @lf
  647. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_emails].''' + @lf
  648. SET @batchText = @batchText + 'PRINT @message ' + @lf
  649. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_emails] ON ' + @lf
  650. SET @batchText = @batchText + 'INSERT INTO [UDC_emails]( ' + @lf
  651. SET @batchText = @batchText + ' [contactID], [seqNo], [useType], [email], [flag]) ' + @lf
  652. SET @batchText = @batchText + 'SELECT ' + @lf
  653. SET @batchText = @batchText + ' [contactID], [seqNo], [useType], [email], [flag] ' + @lf
  654. SET @batchText = @batchText + 'FROM ' + @lf
  655. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_emails] ' + @lf
  656. SET @batchText = @batchText + 'ORDER BY ' + @lf
  657. SET @batchText = @batchText + ' [contactID], [seqNo] ' + @lf
  658. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  659. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_emails.''' + @lf
  660. SET @batchText = @batchText + 'PRINT @message ' + @lf
  661. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_emails] OFF ' + @lf
  662. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_emails] ' + @lf
  663. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_emails.''' + @lf
  664. SET @batchText = @batchText + 'PRINT @message ' + @lf
  665. SET @message=REPLICATE('=',80)
  666. PRINT @message
  667. PRINT 'UDC_emails to UDC_emails'
  668. SET @message=REPLICATE('-',80)
  669. PRINT @message
  670. PRINT @batchText
  671. SET @message=REPLICATE('-',80)
  672. PRINT @message
  673. PRINT 'Results: '
  674. SET @message=REPLICATE('-',80)
  675. PRINT @message
  676. EXEC (@batchText)
  677. SET @message=REPLICATE('=',80)
  678. PRINT @message
  679. --
  680. -- Migrate UDC_phones to UDC_phones
  681. --
  682. SET @batchText = ''
  683. SET @batchText = @batchText + '' + @lf
  684. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  685. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_phones] ' + @lf
  686. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_phones].''' + @lf
  687. SET @batchText = @batchText + 'PRINT @message ' + @lf
  688. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_phones] ON ' + @lf
  689. SET @batchText = @batchText + 'INSERT INTO [UDC_phones]( ' + @lf
  690. SET @batchText = @batchText + ' [contactID], [seqNo], [useType], [phone], [flag]) ' + @lf
  691. SET @batchText = @batchText + 'SELECT ' + @lf
  692. SET @batchText = @batchText + ' [contactID], [seqNo], [useType], [phone], [flag] ' + @lf
  693. SET @batchText = @batchText + 'FROM ' + @lf
  694. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_phones] ' + @lf
  695. SET @batchText = @batchText + 'ORDER BY ' + @lf
  696. SET @batchText = @batchText + ' [contactID], [seqNo] ' + @lf
  697. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  698. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_phones.''' + @lf
  699. SET @batchText = @batchText + 'PRINT @message ' + @lf
  700. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_phones] OFF ' + @lf
  701. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_phones] ' + @lf
  702. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_phones.''' + @lf
  703. SET @batchText = @batchText + 'PRINT @message ' + @lf
  704. SET @message=REPLICATE('=',80)
  705. PRINT @message
  706. PRINT 'UDC_phones to UDC_phones'
  707. SET @message=REPLICATE('-',80)
  708. PRINT @message
  709. PRINT @batchText
  710. SET @message=REPLICATE('-',80)
  711. PRINT @message
  712. PRINT 'Results: '
  713. SET @message=REPLICATE('-',80)
  714. PRINT @message
  715. EXEC (@batchText)
  716. SET @message=REPLICATE('=',80)
  717. PRINT @message
  718. --
  719. -- Migrate UDC_addresses to UDC_addresses
  720. --
  721. SET @batchText = ''
  722. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  723. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_addresses] ' + @lf
  724. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_addresses].''' + @lf
  725. SET @batchText = @batchText + 'PRINT @message ' + @lf
  726. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_addresses] ON ' + @lf
  727. SET @batchText = @batchText + 'INSERT INTO [UDC_addresses]( ' + @lf
  728. SET @batchText = @batchText + ' [addressID], [contactID], [sortCode], [useType], [tModelKey], [flag]) ' + @lf
  729. SET @batchText = @batchText + 'SELECT ' + @lf
  730. SET @batchText = @batchText + ' [addressID], [contactID], [sortCode], [useType], NULL, [flag] ' + @lf
  731. SET @batchText = @batchText + 'FROM ' + @lf
  732. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_addresses] ' + @lf
  733. SET @batchText = @batchText + 'ORDER BY ' + @lf
  734. SET @batchText = @batchText + ' [addressID], [contactID] ' + @lf
  735. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  736. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_addresses.''' + @lf
  737. SET @batchText = @batchText + 'PRINT @message ' + @lf
  738. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_addresses] OFF ' + @lf
  739. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_addresses] ' + @lf
  740. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_addresses.''' + @lf
  741. SET @batchText = @batchText + 'PRINT @message ' + @lf
  742. SET @message=REPLICATE('=',80)
  743. PRINT @message
  744. PRINT 'Migrate UDC_addresses'
  745. SET @message=REPLICATE('-',80)
  746. PRINT @message
  747. PRINT @batchText
  748. SET @message=REPLICATE('-',80)
  749. PRINT @message
  750. PRINT 'Results: '
  751. SET @message=REPLICATE('-',80)
  752. PRINT @message
  753. EXEC (@batchText)
  754. SET @message=REPLICATE('=',80)
  755. PRINT @message
  756. --
  757. -- Migrate UDC_addressLines to UDC_addressLines
  758. --
  759. SET @batchText = ''
  760. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  761. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_addressLines] ' + @lf
  762. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_addressLines].''' + @lf
  763. SET @batchText = @batchText + 'PRINT @message ' + @lf
  764. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_addressLines] ON ' + @lf
  765. SET @batchText = @batchText + 'INSERT INTO [UDC_addressLines]( ' + @lf
  766. SET @batchText = @batchText + ' [addressID], [seqNo], [addressLine], [keyName], [keyValue], [flag]) ' + @lf
  767. SET @batchText = @batchText + 'SELECT ' + @lf
  768. SET @batchText = @batchText + ' [addressID], [seqNo], [addressLine], NULL, NULL, [flag] ' + @lf
  769. SET @batchText = @batchText + 'FROM ' + @lf
  770. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_addressLines] ' + @lf
  771. SET @batchText = @batchText + 'ORDER BY ' + @lf
  772. SET @batchText = @batchText + ' [addressID], [seqNo] ' + @lf
  773. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  774. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_addressLines.''' + @lf
  775. SET @batchText = @batchText + 'PRINT @message ' + @lf
  776. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_addressLines] OFF ' + @lf
  777. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_addressLines] ' + @lf
  778. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_addressLines.''' + @lf
  779. SET @batchText = @batchText + 'PRINT @message ' + @lf
  780. SET @message=REPLICATE('=',80)
  781. PRINT @message
  782. PRINT 'UDC_addressLines to UDC_addressLines'
  783. SET @message=REPLICATE('-',80)
  784. PRINT @message
  785. PRINT @batchText
  786. SET @message=REPLICATE('-',80)
  787. PRINT @message
  788. PRINT 'Results: '
  789. SET @message=REPLICATE('-',80)
  790. PRINT @message
  791. EXEC (@batchText)
  792. SET @message=REPLICATE('=',80)
  793. PRINT @message
  794. --
  795. -- Migrate UDC_businessServices to UDC_businessServices
  796. --
  797. SET @batchText = ''
  798. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  799. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_businessServices] ' + @lf
  800. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_businessServices].''' + @lf
  801. SET @batchText = @batchText + 'PRINT @message ' + @lf
  802. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_businessServices] ON ' + @lf
  803. SET @batchText = @batchText + 'INSERT INTO [UDC_businessServices]( ' + @lf
  804. SET @batchText = @batchText + ' [serviceID], [businessID], [generic], [serviceKey], [lastChange], [flag]) ' + @lf
  805. SET @batchText = @batchText + 'SELECT ' + @lf
  806. SET @batchText = @batchText + ' [serviceID], [businessID], [generic], [serviceKey], 0, [flag] ' + @lf
  807. SET @batchText = @batchText + 'FROM ' + @lf
  808. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_businessServices] ' + @lf
  809. SET @batchText = @batchText + 'ORDER BY ' + @lf
  810. SET @batchText = @batchText + ' [serviceID] ' + @lf
  811. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  812. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_businessServices.''' + @lf
  813. SET @batchText = @batchText + 'PRINT @message ' + @lf
  814. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_businessServices] OFF ' + @lf
  815. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_businessServices] ' + @lf
  816. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_businessServices''' + @lf
  817. SET @batchText = @batchText + 'PRINT @message ' + @lf
  818. SET @message=REPLICATE('=',80)
  819. PRINT @message
  820. PRINT 'UDC_businessServices to UDC_businessServices'
  821. SET @message=REPLICATE('-',80)
  822. PRINT @message
  823. PRINT @batchText
  824. SET @message=REPLICATE('-',80)
  825. PRINT @message
  826. PRINT 'Results: '
  827. SET @message=REPLICATE('-',80)
  828. PRINT @message
  829. EXEC (@batchText)
  830. SET @message=REPLICATE('=',80)
  831. PRINT @message
  832. --
  833. -- Migrate UDC_businessServices to UDC_names_BS
  834. --
  835. SET @batchText = ''
  836. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  837. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_businessServices] ' + @lf
  838. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_businessServices].''' + @lf
  839. SET @batchText = @batchText + 'PRINT @message ' + @lf
  840. SET @batchText = @batchText + 'INSERT INTO [UDC_names_BS]( ' + @lf
  841. SET @batchText = @batchText + ' [serviceID], [isoLangCode], [name]) ' + @lf
  842. SET @batchText = @batchText + 'SELECT ' + @lf
  843. SET @batchText = @batchText + ' BS.[serviceID], PU.[isoLangCode], BS.[name] ' + @lf
  844. SET @batchText = @batchText + 'FROM ' + @lf
  845. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_businessServices] BS ' + @lf
  846. SET @batchText = @batchText + ' JOIN [' + @sourceDb + ']..[UDC_businessEntities] BE ON BS.[businessID] = BE.[businessID] ' + @lf
  847. SET @batchText = @batchText + ' JOIN [' + @sourceDb + ']..[UDO_publishers] PU ON BE.[publisherID] = PU.[publisherID] ' + @lf
  848. SET @batchText = @batchText + 'ORDER BY ' + @lf
  849. SET @batchText = @batchText + ' BS.[serviceID] ' + @lf
  850. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  851. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_names_BS.''' + @lf
  852. SET @batchText = @batchText + 'PRINT @message ' + @lf
  853. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_names_BS] ' + @lf
  854. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_names_BS.''' + @lf
  855. SET @batchText = @batchText + 'PRINT @message ' + @lf
  856. SET @message=REPLICATE('=',80)
  857. PRINT @message
  858. PRINT 'Migrate UDC_businessServices to UDC_names_BE'
  859. SET @message=REPLICATE('-',80)
  860. PRINT @message
  861. PRINT @batchText
  862. SET @message=REPLICATE('-',80)
  863. PRINT @message
  864. PRINT 'Results: '
  865. SET @message=REPLICATE('-',80)
  866. PRINT @message
  867. EXEC (@batchText)
  868. SET @message=REPLICATE('=',80)
  869. PRINT @message
  870. --
  871. -- Migrate UDC_serviceDesc to UDC_serviceDesc
  872. --
  873. SET @batchText = ''
  874. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  875. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_serviceDesc] ' + @lf
  876. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_serviceDesc].''' + @lf
  877. SET @batchText = @batchText + 'PRINT @message ' + @lf
  878. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_serviceDesc] ON ' + @lf
  879. SET @batchText = @batchText + 'INSERT INTO [UDC_serviceDesc]( ' + @lf
  880. SET @batchText = @batchText + ' [serviceID], [seqNo], [isoLangCode], [description], [flag]) ' + @lf
  881. SET @batchText = @batchText + 'SELECT ' + @lf
  882. SET @batchText = @batchText + ' [serviceID], [seqNo], [isoLangCode], [description], [flag] ' + @lf
  883. SET @batchText = @batchText + 'FROM ' + @lf
  884. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_serviceDesc] ' + @lf
  885. SET @batchText = @batchText + 'ORDER BY ' + @lf
  886. SET @batchText = @batchText + ' [serviceID] ' + @lf
  887. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  888. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_serviceDesc.''' + @lf
  889. SET @batchText = @batchText + 'PRINT @message ' + @lf
  890. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_serviceDesc] OFF ' + @lf
  891. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_serviceDesc] ' + @lf
  892. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_serviceDesc''' + @lf
  893. SET @batchText = @batchText + 'PRINT @message ' + @lf
  894. SET @message=REPLICATE('=',80)
  895. PRINT @message
  896. PRINT 'Migrate UDC_serviceDesc to UDC_serviceDesc'
  897. SET @message=REPLICATE('-',80)
  898. PRINT @message
  899. PRINT @batchText
  900. SET @message=REPLICATE('-',80)
  901. PRINT @message
  902. PRINT 'Results: '
  903. SET @message=REPLICATE('-',80)
  904. PRINT @message
  905. EXEC (@batchText)
  906. SET @message=REPLICATE('=',80)
  907. PRINT @message
  908. --
  909. -- Migrate UDC_categoryBag_BS TO UDC_categoryBag_BS
  910. --
  911. SET @batchText = ''
  912. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  913. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_categoryBag_BS] ' + @lf
  914. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' businessService rows in [' + @sourceDb + ']..[UDC_categoryBag_BS].''' + @lf
  915. SET @batchText = @batchText + 'PRINT @message ' + @lf
  916. SET @batchText = @batchText + 'INSERT [UDC_categoryBag_BS]( ' + @lf
  917. SET @batchText = @batchText + ' [serviceID], [keyName], [keyValue], [tModelKey], [flag]) ' + @lf
  918. SET @batchText = @batchText + 'SELECT ' + @lf
  919. SET @batchText = @batchText + ' [serviceID], [keyName], [keyValue], [tModelKey], [flag] ' + @lf
  920. SET @batchText = @batchText + 'FROM ' + @lf
  921. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_categoryBag_BS] ' + @lf
  922. SET @batchText = @batchText + 'ORDER BY ' + @lf
  923. SET @batchText = @batchText + ' [seqNo] ' + @lf
  924. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  925. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_categoryBag_BS.''' + @lf
  926. SET @batchText = @batchText + 'PRINT @message ' + @lf
  927. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_categoryBag_BS] ' + @lf
  928. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_categoryBag_BS.''' + @lf
  929. SET @batchText = @batchText + 'PRINT @message ' + @lf
  930. SET @message=REPLICATE('=',80)
  931. PRINT @message
  932. PRINT 'UDC_categoryBag TO UDC_categoryBag_BS'
  933. SET @message=REPLICATE('-',80)
  934. PRINT @message
  935. PRINT @batchText
  936. SET @message=REPLICATE('-',80)
  937. PRINT @message
  938. PRINT 'Results: '
  939. SET @message=REPLICATE('-',80)
  940. PRINT @message
  941. EXEC (@batchText)
  942. SET @message=REPLICATE('=',80)
  943. PRINT @message
  944. --
  945. -- Migrate UDC_bindingTemplates to UDC_bindingTemplates
  946. --
  947. SET @batchText = ''
  948. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  949. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_bindingTemplates] ' + @lf
  950. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_bindingTemplates].''' + @lf
  951. SET @batchText = @batchText + 'PRINT @message ' + @lf
  952. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_bindingTemplates] ON ' + @lf
  953. SET @batchText = @batchText + 'INSERT INTO [UDC_bindingTemplates]( ' + @lf
  954. SET @batchText = @batchText + ' [bindingID], [serviceID], [generic], [bindingKey], [URLTypeID], [accessPoint], [hostingRedirector], [lastChange], [flag]) ' + @lf
  955. SET @batchText = @batchText + 'SELECT ' + @lf
  956. SET @batchText = @batchText + ' [bindingID], [serviceID], [generic], [bindingKey], [URLTypeID] - 1, [accessPoint], [hostingRedirector], 0, [flag] ' + @lf
  957. SET @batchText = @batchText + 'FROM ' + @lf
  958. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_bindingTemplates] ' + @lf
  959. SET @batchText = @batchText + 'ORDER BY ' + @lf
  960. SET @batchText = @batchText + ' [bindingID], [serviceID] ' + @lf
  961. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  962. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_bindingTemplates.''' + @lf
  963. SET @batchText = @batchText + 'PRINT @message ' + @lf
  964. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_bindingTemplates] OFF ' + @lf
  965. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_bindingTemplates] ' + @lf
  966. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_bindingTemplates''' + @lf
  967. SET @batchText = @batchText + 'PRINT @message ' + @lf
  968. SET @message=REPLICATE('=',80)
  969. PRINT @message
  970. PRINT 'UDC_bindingTemplates to UDC_bindingTemplates'
  971. SET @message=REPLICATE('-',80)
  972. PRINT @message
  973. PRINT @batchText
  974. SET @message=REPLICATE('-',80)
  975. PRINT @message
  976. PRINT 'Results: '
  977. SET @message=REPLICATE('-',80)
  978. PRINT @message
  979. EXEC (@batchText)
  980. SET @message=REPLICATE('=',80)
  981. PRINT @message
  982. --
  983. -- Migrate UDC_bindingDesc to UDC_bindingDesc
  984. --
  985. SET @batchText = ''
  986. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  987. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_bindingDesc] ' + @lf
  988. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_bindingDesc].''' + @lf
  989. SET @batchText = @batchText + 'PRINT @message ' + @lf
  990. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_bindingDesc] ON ' + @lf
  991. SET @batchText = @batchText + 'INSERT INTO [UDC_bindingDesc]( ' + @lf
  992. SET @batchText = @batchText + ' [bindingID], [seqNo], [isoLangCode], [description], [flag]) ' + @lf
  993. SET @batchText = @batchText + 'SELECT ' + @lf
  994. SET @batchText = @batchText + ' [bindingID], [seqNo], [isoLangCode], [description], [flag] ' + @lf
  995. SET @batchText = @batchText + 'FROM ' + @lf
  996. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_bindingDesc] ' + @lf
  997. SET @batchText = @batchText + 'ORDER BY ' + @lf
  998. SET @batchText = @batchText + ' [bindingID], [seqNo] ' + @lf
  999. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  1000. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_bindingDesc.''' + @lf
  1001. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1002. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_bindingDesc] OFF ' + @lf
  1003. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_bindingDesc] ' + @lf
  1004. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_bindingDesc''' + @lf
  1005. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1006. SET @message=REPLICATE('=',80)
  1007. PRINT @message
  1008. PRINT 'UDC_bindingDesc to UDC_bindingDesc'
  1009. SET @message=REPLICATE('-',80)
  1010. PRINT @message
  1011. PRINT @batchText
  1012. SET @message=REPLICATE('-',80)
  1013. PRINT @message
  1014. PRINT 'Results: '
  1015. SET @message=REPLICATE('-',80)
  1016. PRINT @message
  1017. EXEC (@batchText)
  1018. SET @message=REPLICATE('=',80)
  1019. PRINT @message
  1020. --
  1021. -- Migrate UDC_tModelInstances to UDC_tModelInstances
  1022. --
  1023. SET @batchText = ''
  1024. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  1025. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_tModelInstances] ' + @lf
  1026. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_tModelInstances].''' + @lf
  1027. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1028. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_tModelInstances] ON ' + @lf
  1029. SET @batchText = @batchText + 'INSERT INTO [UDC_tModelInstances]( ' + @lf
  1030. SET @batchText = @batchText + ' [instanceID], [bindingID], [tModelKey], [overviewURL], [instanceParms], [flag]) ' + @lf
  1031. SET @batchText = @batchText + 'SELECT ' + @lf
  1032. SET @batchText = @batchText + ' [instanceID], [bindingID], [tModelKey], [overviewURL], [instanceParms], [flag] ' + @lf
  1033. SET @batchText = @batchText + 'FROM ' + @lf
  1034. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_tModelInstances] ' + @lf
  1035. SET @batchText = @batchText + 'ORDER BY ' + @lf
  1036. SET @batchText = @batchText + ' [instanceID], [bindingID] ' + @lf
  1037. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  1038. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_tModelInstances.''' + @lf
  1039. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1040. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_tModelInstances] OFF ' + @lf
  1041. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_tModelInstances] ' + @lf
  1042. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_tModelInstances''' + @lf
  1043. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1044. SET @message=REPLICATE('=',80)
  1045. PRINT @message
  1046. PRINT 'UDC_tModelInstances to UDC_tModelInstances'
  1047. SET @message=REPLICATE('-',80)
  1048. PRINT @message
  1049. PRINT @batchText
  1050. SET @message=REPLICATE('-',80)
  1051. PRINT @message
  1052. PRINT 'Results: '
  1053. SET @message=REPLICATE('-',80)
  1054. PRINT @message
  1055. EXEC (@batchText)
  1056. SET @message=REPLICATE('=',80)
  1057. PRINT @message
  1058. --
  1059. -- Migrate UDC_instanceDesc to UDC_instanceDesc
  1060. --
  1061. SET @batchText = ''
  1062. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  1063. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_instanceDesc] ' + @lf
  1064. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_instanceDesc].''' + @lf
  1065. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1066. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_instanceDesc] ON ' + @lf
  1067. SET @batchText = @batchText + 'INSERT [UDC_instanceDesc]( ' + @lf
  1068. SET @batchText = @batchText + ' [instanceID], [seqNo], [elementID], [isoLangCode], [description], [flag])' + @lf
  1069. SET @batchText = @batchText + 'SELECT ' + @lf
  1070. SET @batchText = @batchText + ' [instanceID], [seqNo], [elementID] - 1, [isoLangCode], [description], [flag] ' + @lf
  1071. SET @batchText = @batchText + 'FROM ' + @lf
  1072. SET @batchText = @batchText + ' [' + @sourceDb + ']..[UDC_instanceDesc] ' + @lf
  1073. SET @batchText = @batchText + 'ORDER BY ' + @lf
  1074. SET @batchText = @batchText + ' [instanceID], [seqNo] ' + @lf
  1075. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  1076. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows migrated to UDC_instanceDesc.''' + @lf
  1077. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1078. SET @batchText = @batchText + 'SET IDENTITY_INSERT [UDC_instanceDesc] OFF ' + @lf
  1079. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_instanceDesc] ' + @lf
  1080. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_instanceDesc''' + @lf
  1081. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1082. SET @message=REPLICATE('=',80)
  1083. PRINT @message
  1084. PRINT 'UDC_instanceDesc to UDC_instanceDesc'
  1085. SET @message=REPLICATE('-',80)
  1086. PRINT @message
  1087. PRINT @batchText
  1088. SET @message=REPLICATE('-',80)
  1089. PRINT @message
  1090. PRINT 'Results: '
  1091. SET @message=REPLICATE('-',80)
  1092. PRINT @message
  1093. EXEC (@batchText)
  1094. SET @message=REPLICATE('=',80)
  1095. PRINT @message
  1096. --
  1097. -- Perform test mode database cleanup operations
  1098. --
  1099. IF @mode = '/t'
  1100. BEGIN
  1101. SET @message=REPLICATE('=',80)
  1102. PRINT @message
  1103. PRINT 'Deleting all MS businesses with dependencies on IBM bindings and tModels that are not in bootstrap files'
  1104. SET @message=REPLICATE('-',80)
  1105. PRINT @message
  1106. DECLARE @tempKeys TABLE(
  1107. [businessKey] uniqueidentifier,
  1108. [description] varchar(20))
  1109. INSERT @tempKeys(
  1110. [businessKey],
  1111. [description])
  1112. SELECT DISTINCT
  1113. BE.[businessKey],
  1114. 'hostingRedirector'
  1115. FROM
  1116. [UDC_businessEntities] BE
  1117. JOIN [UDC_businessServices] BS ON BE.[businessID] = BS.[businessID]
  1118. JOIN [UDC_bindingTemplates] BT ON BS.[serviceID] = BT.[serviceID]
  1119. JOIN [UDC_bindingTemplates] BT2 ON BT.[hostingRedirector] = BT2.[bindingKey]
  1120. WHERE
  1121. (BE.[publisherID] <> 2) AND
  1122. (BT.[hostingRedirector] IS NOT NULL) AND
  1123. (dbo.getBindingPublisherID(BT2.[bindingKey]) = 2)
  1124. INSERT @tempKeys(
  1125. [businessKey],
  1126. [description])
  1127. SELECT DISTINCT
  1128. BE.[businessKey],
  1129. 'tModelInstance'
  1130. FROM
  1131. [UDC_businessEntities] BE
  1132. JOIN [UDC_businessServices] BS ON BE.[businessID] = BS.[businessID]
  1133. JOIN [UDC_bindingTemplates] BT ON BS.[serviceID] = BT.[serviceID]
  1134. JOIN [UDC_tModelInstances] TI ON BT.[bindingID] = TI.[bindingID]
  1135. JOIN [UDC_tModels] TM ON TI.[tModelKey] = TM.[tModelKey]
  1136. WHERE
  1137. (BE.[publisherID] <> 2) AND
  1138. (TM.[publisherID] = 2) AND
  1139. (TM.[tModelKey] NOT IN (
  1140. 'C1ACF26D-9672-4404-9D70-39B756E62AB4',
  1141. '4CD7E4BC-648B-426D-9936-443EAAC8AE23',
  1142. '64C756D1-3374-4E00-AE83-EE12E38FAE63',
  1143. '3FB66FB7-5FC3-462F-A351-C140D9BD8304',
  1144. 'AC104DCC-D623-452F-88A7-F8ACD94D9B2B',
  1145. 'A2F36B65-2D66-4088-ABC7-914D0E05EB9E',
  1146. '1E3E9CBC-F8CE-41AB-8F99-88326BAD324A',
  1147. 'A035A07C-F362-44dd-8F95-E2B134BF43B4',
  1148. '4064C064-6D14-4F35-8953-9652106476A9',
  1149. '807A2C6A-EE22-470D-ADC7-E0424A337C03',
  1150. '327A56F0-3299-4461-BC23-5CD513E95C55',
  1151. '93335D49-3EFB-48A0-ACEA-EA102B60DDC6',
  1152. '1A2B00BE-6E2C-42F5-875B-56F32686E0E7',
  1153. '5FCF5CD0-629A-4C50-8B16-F94E9CF2A674',
  1154. '38E12427-5536-4260-A6F9-B5B530E63A07',
  1155. '68DE9E80-AD09-469D-8A37-088422BFBC36',
  1156. '4CEC1CEF-1F68-4B23-8CB7-8BAA763AEB89',
  1157. 'DB77450D-9FA8-45D4-A7BC-04411D14E384',
  1158. 'CD153257-086A-4237-B336-6BDCBDCC6634',
  1159. '4E49A8D6-D5A2-4FC2-93A0-0411D8D19E88',
  1160. '8609C81E-EE1F-4D5A-B202-3EB13AD01823',
  1161. 'B1B1BAF5-2329-43E6-AE13-BA8E97195039',
  1162. 'C0B9FE13-179F-413D-8A5B-5004DB8E5BB2'))
  1163. SELECT * FROM @tempKeys
  1164. DELETE
  1165. [UDC_businessEntities]
  1166. WHERE
  1167. ([businessKey] IN (SELECT DISTINCT [businessKey] FROM @tempKeys))
  1168. SET @rows=@@ROWCOUNT
  1169. SET @message=CAST(@rows AS varchar(8000)) + ' businessEntities deleted.'
  1170. PRINT @message
  1171. SET @message=REPLICATE('=',80)
  1172. PRINT @message
  1173. END
  1174. --
  1175. -- Perform heartland tModel cleanup
  1176. --
  1177. IF @mode = '/h'
  1178. BEGIN
  1179. SET @batchText = ''
  1180. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  1181. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDC_tModels] ' + @lf
  1182. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_tModels].''' + @lf
  1183. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1184. SET @batchText = @batchText + 'DELETE ' + @lf
  1185. SET @batchText = @batchText + ' [UDC_tModels] ' + @lf
  1186. SET @batchText = @batchText + 'WHERE ' + @lf
  1187. SET @batchText = @batchText + ' ([tModelKey] IN (''C1ACF26D-9672-4404-9D70-39B756E62AB4'',''4CD7E4BC-648B-426D-9936-443EAAC8AE23'',''64C756D1-3374-4E00-AE83-EE12E38FAE63'',''3FB66FB7-5FC3-462F-A351-C140D9BD8304'',''AC104DCC-D623-452F-88A7-F8ACD94D9B2B'',''A2F36B65-2D66-4088-ABC7-914D0E05EB9E'',''1E3E9CBC-F8CE-41AB-8F99-88326BAD324A'',''A035A07C-F362-44dd-8F95-E2B134BF43B4'',''e4a56494-4946-4805-aca5-546b8d08eefd'',''f358808c-e939-4813-a407-8873bfdc3d57'',''0c61e2c3-73c5-4743-8163-6647af5b4b9e'',''ce653789-f6d4-41b7-b7f4-31501831897d'',''b3c0835e-7206-41e0-9311-c8ad8fb19f73'',''BE37F93E-87B4-4982-BF6D-992A8E44EDAB'',''4064C064-6D14-4F35-8953-9652106476A9'',''807A2C6A-EE22-470D-ADC7-E0424A337C03'',''327A56F0-3299-4461-BC23-5CD513E95C55'',''93335D49-3EFB-48A0-ACEA-EA102B60DDC6'',''1A2B00BE-6E2C-42F5-875B-56F32686E0E7'',''5FCF5CD0-629A-4C50-8B16-F94E9CF2A674'',''38E12427-5536-4260-A6F9-B5B530E63A07'',''68DE9E80-AD09-469D-8A37-088422BFBC36'',''4CEC1CEF-1F68-4B23-8CB7-8BAA763AEB89'',''4c1f2e1f-4b7c-44eb-9b87-6e7d80f82b3e'')) ' + @lf
  1188. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  1189. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows deleted from UDC_tModels.''' + @lf
  1190. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1191. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDC_tModels] ' + @lf
  1192. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDC_tModels''' + @lf
  1193. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1194. SET @message=REPLICATE('=',80)
  1195. PRINT @message
  1196. PRINT 'Deleting heartland tModels that are to be boostrapped'
  1197. SET @message=REPLICATE('-',80)
  1198. PRINT @message
  1199. PRINT @batchText
  1200. SET @message=REPLICATE('-',80)
  1201. PRINT @message
  1202. PRINT 'Results: '
  1203. SET @message=REPLICATE('-',80)
  1204. PRINT @message
  1205. EXEC (@batchText)
  1206. SET @message=REPLICATE('=',80)
  1207. PRINT @message
  1208. SET @batchText = ''
  1209. SET @batchText = @batchText + 'DECLARE @rows int, @message varchar(8000) ' + @lf
  1210. SET @batchText = @batchText + 'SELECT @rows=COUNT(*) FROM [' + @sourceDb + ']..[UDO_publishers] ' + @lf
  1211. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in [' + @sourceDb + ']..[UDC_tModels].''' + @lf
  1212. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1213. SET @batchText = @batchText + 'UPDATE ' + @lf
  1214. SET @batchText = @batchText + ' [UDO_publishers] ' + @lf
  1215. SET @batchText = @batchText + 'SET ' + @lf
  1216. SET @batchText = @batchText + ' [PUID] = ''System'' ' + @lf
  1217. SET @batchText = @batchText + 'WHERE ' + @lf
  1218. SET @batchText = @batchText + ' ([publisherID] = 4) ' + @lf
  1219. SET @batchText = @batchText + 'SET @rows = @@ROWCOUNT ' + @lf
  1220. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows updated in UDO_publishers.''' + @lf
  1221. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1222. SET @batchText = @batchText + 'SELECT @rows = COUNT(*) FROM [UDO_publishers] ' + @lf
  1223. SET @batchText = @batchText + 'SET @message = CAST(@rows AS varchar(8000)) + '' rows in UDO_publishers''' + @lf
  1224. SET @batchText = @batchText + 'PRINT @message ' + @lf
  1225. SET @message=REPLICATE('=',80)
  1226. PRINT @message
  1227. PRINT 'Fixing PUID for Heartland System publisher.'
  1228. SET @message=REPLICATE('-',80)
  1229. PRINT @message
  1230. PRINT @batchText
  1231. SET @message=REPLICATE('-',80)
  1232. PRINT @message
  1233. PRINT 'Results: '
  1234. SET @message=REPLICATE('-',80)
  1235. PRINT @message
  1236. EXEC (@batchText)
  1237. SET @message=REPLICATE('=',80)
  1238. PRINT @message
  1239. END
  1240. --
  1241. -- Execute batch
  1242. --
  1243. SET @stop = getdate()
  1244. SET @duration = @stop - @start
  1245. SET @message = 'Total Script Duration: ' + CONVERT(varchar(8000),@duration, 8)
  1246. PRINT @message
  1247. RETURN 0
  1248. END
  1249. GO