home *** CD-ROM | disk | FTP | other *** search
/ gimli.bioss.sari.ac.uk / gimli.bioss.sari.ac.uk.zip / gimli.bioss.sari.ac.uk / pub / misc / McAfee8.7.Zip / ePOPolicyMigration.exe / CABFILE / 1 / 80To87_Task_Upgrade_Script_For_ePO4.0.sql < prev    next >
Text File  |  2009-09-30  |  18KB  |  542 lines

  1. -------------------------------------------------------------------------------
  2.  
  3. -------------  V S E  8 . 0  T O  8 . 7  T A S K  U P G R A D E  --------------
  4.  
  5. -------------------------------------------------------------------------------
  6.  
  7. if exists (select * from tempdb..sysobjects where name like '#VseTmpUpgradeTask%')
  8. drop table #VseTmpUpgradeTask
  9. go
  10.  
  11. CREATE TABLE [dbo].[#VseTmpUpgradeTask] (
  12.     [AutoID] [int] IDENTITY (1, 1) NOT NULL ,
  13.     [ParentID] [int] NOT NULL ,
  14.     [ParentType] [tinyint] NOT NULL ,
  15.     [GlobalTaskID] [int] NOT NULL ,
  16.     [ProductCode] [nvarchar] (50) NULL ,
  17.     [TaskType] [nvarchar] (50) NULL ,
  18.     [TaskName] [nvarchar] (256) NULL ,
  19.     [TaskDesc] [nvarchar] (250) NULL ,
  20.     [PlatformsSupported] [nvarchar] (250) NULL ,
  21.     [EditURL] [nvarchar] (250) NULL ,
  22.     [SaveURL] [nvarchar] (250) NULL ,
  23.     [TaskFlags] [tinyint] NULL ,
  24.     [TheTimestamp] [binary] (8) NULL ,
  25.     [DeleteTimestamp] [binary] (8) NULL ,
  26.     [JustPlaceHolder] [bit] NULL ,
  27.     [Priority] [int] NULL,
  28.     [VSE87AutoID] [int],        -- must link VSE 8.7 autoid
  29.     [VSE80AutoID] [int]            -- with VSE 8.0 autoid
  30. )
  31. go
  32.  
  33. declare @Continue int
  34. declare @DoNotForce80 nvarchar(30)
  35. declare @DoNotForce nvarchar(30)
  36.     
  37. select @Continue = 1
  38. select @DoNotForce80 = 'DO_NOT_FORCE_80'
  39. select @DoNotForce = 'DO_NOT_FORCE_%'
  40.  
  41. -- Don't copy any tasks if 8.7 tasks already exist
  42. if exists (select * from EPOTask where ProductCode = 'VIRUSCAN8700' and ParentType = 7 and GlobalTaskID > 0)
  43. begin
  44.     select @Continue = 0
  45. end
  46.  
  47. if @DoNotForce80 like @DoNotForce
  48. begin
  49.     if exists (select * from EPOTask where ProductCode = 'VIRUSCAN8600' and ParentType = 7 and GlobalTaskID > 0)
  50.     begin
  51.         select @Continue = 0
  52.     end
  53. end
  54.  
  55. if @Continue = 1
  56. begin
  57.  
  58. -- Convert VSE8.0 tasks
  59. -- Copy over all task data and relink globaltaskid field
  60. -- Must copy over task and policies not just move them
  61. -- Copy all non global EPOTask table 8.0 policies to 8.7 policies
  62. -- Copy over global root tasks, but only those with GlobalTaskID > 0
  63.  
  64. -- copy all VSE 8.0 tasks
  65. insert #VseTmpUpgradeTask
  66. (ParentID, ParentType, GlobalTaskID,  ProductCode, TaskType, TaskName, TaskDesc,
  67.   PlatformsSupported, EditURL, SaveURL, TaskFlags, TheTimestamp, DeleteTimestamp, JustPlaceHolder, Priority, VSE87AutoID, VSE80AutoID)
  68. select 
  69. ParentID, ParentType, GlobalTaskID, 'VIRUSCAN8700' as ProductCode, TaskType, TaskName, TaskDesc,
  70.   PlatformsSupported, EditURL, SaveURL, TaskFlags, TheTimestamp, DeleteTimestamp, JustPlaceHolder, Priority, 0 as VSE87AutoID, autoid as VSE80AutoID
  71. from EPOTask
  72. where
  73. EPOTask.ProductCode = 'VIRUSCAN8000'
  74. and 
  75. (
  76. ParentType in (6,5,4,3,1)
  77. or
  78. (ParentType = 7 and GlobalTaskID > 0 )
  79. )
  80. and EPOTask.TaskType = 'VSC700_Scan_Task'
  81. order by autoid
  82.  
  83. -- Find next task autoid value
  84. Declare @NextTaskid int
  85. Select @NextTaskid = IDENT_CURRENT('EPOTask')
  86.  
  87. -- populate VSE87AutoID field in #VseTmpUpgradeTask
  88. Update #VseTmpUpgradeTask
  89. set VSE87AutoID = @NextTaskid + autoid
  90.  
  91. -- create VSE 8.7 tasks
  92. insert EPOTask
  93. (ParentID, ParentType, GlobalTaskID,  ProductCode, TaskType, TaskName, TaskDesc,
  94.   PlatformsSupported, EditURL, SaveURL, TaskFlags, TheTimestamp, DeleteTimestamp, JustPlaceHolder, Priority)
  95.  
  96. select 
  97. ParentID, ParentType, GlobalTaskID,   'VIRUSCAN8700' as ProductCode, 
  98.     TaskType, TaskName + ' (VSE 8.7i)', TaskDesc, PlatformsSupported, 
  99.     EditURL, SaveURL, TaskFlags, TheTimestamp, DeleteTimestamp, JustPlaceHolder, Priority
  100. from #VseTmpUpgradeTask
  101. order by autoid
  102.  
  103. -- Delete the old "(VSE 8.0i)" if it is an old upgraded 7.1 task
  104. update EPOTask
  105. Set EPOTask.TaskName = replace(EPOTask.TaskName, ' (VSE 8.0i)', '')
  106. where
  107. patindex('% (VSE 8.0i)%', EPOTask.TaskName) > 0
  108. and EPOTask.ProductCode = 'VIRUSCAN8700'
  109. and 
  110. (
  111. EPOTask.ParentType in (6,5,4,3,1)
  112. or
  113. (EPOTask.ParentType = 7 and EPOTask.GlobalTaskID > 0 )
  114. )
  115. and EPOTask.TaskType = 'VSC700_Scan_Task'
  116.  
  117. -- Update GlobalTaskID field, link it to VSE 8.7 task instead of VSE 8.0 task
  118. update EPOTask
  119. Set GlobalTaskID = VSE87AutoID
  120. From #VseTmpUpgradeTask
  121. where
  122. EPOTask.GlobalTaskID = #VseTmpUpgradeTask.VSE80AutoID
  123. and EPOTask.ProductCode = 'VIRUSCAN8700'
  124. and 
  125. (
  126. EPOTask.ParentType in (6,5,4,3,1)
  127. or
  128. (EPOTask.ParentType = 7 and EPOTask.GlobalTaskID > 0 )
  129. )
  130. and EPOTask.TaskType = 'VSC700_Scan_Task'
  131.  
  132. -- Update the GlobalTaskID for global root tasks, 
  133. -- (but only for those with with GlobalTaskID > 0)
  134. Declare @Root80Taskid int
  135. Select @Root80Taskid = AutoId
  136. From EPOTask
  137. where ParentType = 7
  138. and GlobalTaskID = 0
  139. and ProductCode = 'VIRUSCAN8000'
  140. and TaskType = 'VSC700_Scan_Task'
  141.  
  142. Declare @Root87Taskid int
  143. Select @Root87Taskid = AutoId
  144. From EPOTask
  145. where ParentType = 7
  146. and GlobalTaskID = 0
  147. and ProductCode = 'VIRUSCAN8700'
  148. and TaskType = 'VSC700_Scan_Task'
  149.  
  150. update EPOTask
  151. Set GlobalTaskID = @Root87Taskid
  152. where
  153. EPOTask.ProductCode = 'VIRUSCAN8700'
  154. and GlobalTaskID = @Root80Taskid
  155. and 
  156. (
  157. ParentType in (6,5,4,3,1)
  158. or
  159. (ParentType = 7 and GlobalTaskID > 0 )
  160. )
  161. and TaskType = 'VSC700_Scan_Task'
  162.  
  163. -- copy VSE 8.0 task settings to VSE 8.7 task settings
  164. -- Copy all non global task settings from 8.0 task settings to 8.7 task settings
  165. -- copy only settings where GlobalTaskID > 0
  166. -- Change parentid to point to the VSE 8.7 task
  167. insert EPOTaskSettings
  168. (ParentID, SectionName, SettingName, Value, TheTimestamp)
  169. select VSE87AutoID, SectionName, SettingName, Value, EPOTaskSettings.TheTimestamp
  170. from EPOTaskSettings, #VseTmpUpgradeTask
  171. where
  172. EPOTaskSettings.ParentID = #VseTmpUpgradeTask.VSE80AutoID
  173.  
  174. /* ----------------------------------------------------------------------------
  175.  Change the SectionName and/or the SettingName of the policies that have moved.
  176.  A "-" sign indicates that the value is no longer used and is to be deleted only.
  177.  
  178. OLD VALUE:                                                        NEW VALUE:
  179. [Actions]                                                        [Actions]
  180. uAction                                        = 3    (Move)        =>  = 4 (Delete)
  181. uSecAction                                                    =>  = 1 (Continue)
  182.  
  183. [Actions]                                                        [Actions]
  184. uAction                                        = 5    (Clean)
  185. uSecAction                                    = 3    (Move)        =>  = 4 (Delete)
  186.  
  187. [Actions]                                                        [Actions]
  188. uAction                                        = 4    (Delete)
  189. uSecAction                                    = 3    (Move)        =>  = 1 (Continue)
  190.  
  191. [Spyware]                                                        [Spyware]
  192. uAction_Program                                = 3    (Move)        =>  = 4 (Delete)
  193. uSecAction_Program                                            =>  = 1 (Continue)
  194.  
  195. [Spyware]                                                        [Spyware]
  196. uAction_Program                                = 5    (Clean)
  197. uSecAction_Program                            = 3    (Move)        =>  = 4 (Delete)
  198.  
  199. [Spyware]                                                        [Spyware]
  200. uAction_Program                                = 4    (Delete)
  201. uSecAction_Program                            = 3    (Move)        =>  = 1 (Continue)
  202.  
  203. [Actions]                                                        
  204. -szMoveToFolder
  205. -szSecMoveToFolder
  206.  
  207. [Reports]                                                
  208. -bLogUsername
  209.  
  210. [Advanced]                                                
  211. bDeferScanOnBattery=0
  212.  
  213. [Advanced]                                                
  214. bDeferScanInFullScreen=0
  215.  
  216. [Advanced]                                                
  217. uDeferTime=1
  218. ----------------------------------------------------------------------------- */
  219.  
  220. /* ----------------------------------------------------------------------------
  221. [Actions]                                                        [Actions]
  222. uAction                                        = 3    (Move)        =>  = 4 (Delete)
  223. uSecAction                                                    =>  = 1 (Continue)
  224. ---------------------------------------------------------------------------- */
  225. update EPOTaskSettings
  226. set Value = '1'
  227. where
  228. SectionName = 'Actions'
  229. and SettingName = 'uSecAction'
  230. and EPOTaskSettings.parentid in 
  231.     (select b.parentid
  232.     from #VseTmpUpgradeTask, EPOTaskSettings b
  233.     where
  234.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  235.     and b.SectionName = 'Actions'
  236.     and b.SettingName = 'uAction'
  237.     and b.Value = '3'
  238.     )
  239.  
  240. update EPOTaskSettings
  241. set Value = '4'
  242. where
  243. SectionName = 'Actions'
  244. and SettingName = 'uAction'
  245. and EPOTaskSettings.parentid in 
  246.     (select b.parentid
  247.     from #VseTmpUpgradeTask, EPOTaskSettings b
  248.     where
  249.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  250.     and b.SectionName = 'Actions'
  251.     and b.SettingName = 'uAction'
  252.     and b.Value = '3'
  253.     )
  254.  
  255. /* ----------------------------------------------------------------------------
  256. [Actions]                                                        [Actions]
  257. uAction                                        = 5 (Clean)
  258. uSecAction                                    = 3    (Move)        =>  = 4 (Delete)
  259. ---------------------------------------------------------------------------- */
  260. update EPOTaskSettings
  261. set Value = '4'
  262. where
  263. SectionName = 'Actions'
  264. and SettingName = 'uSecAction'
  265. and EPOTaskSettings.parentid in 
  266.     (select b.parentid
  267.     from #VseTmpUpgradeTask, EPOTaskSettings b, EPOTaskSettings c
  268.     where
  269.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  270.     and b.SectionName = 'Actions'
  271.     and b.SettingName = 'uAction'
  272.     and b.Value = '5'
  273.     and b.ParentID = c.ParentID
  274.     and c.SectionName = 'Actions'
  275.     and c.SettingName = 'uSecAction'
  276.     and c.Value = '3'
  277.     )
  278.  
  279. /* ----------------------------------------------------------------------------
  280. [Actions]                                                        [Actions]
  281. uAction                                        = 4    (Delete)
  282. uSecAction                                    = 3    (Move)        =>  = 1 (Continue)
  283. ---------------------------------------------------------------------------- */
  284. update EPOTaskSettings
  285. set Value = '1'
  286. where
  287. SectionName = 'Actions'
  288. and SettingName = 'uSecAction'
  289. and EPOTaskSettings.parentid in 
  290.     (select b.parentid
  291.     from #VseTmpUpgradeTask, EPOTaskSettings b, EPOTaskSettings c
  292.     where
  293.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  294.     and b.SectionName = 'Actions'
  295.     and b.SettingName = 'uAction'
  296.     and b.Value = '4'
  297.     and b.ParentID = c.ParentID
  298.     and c.SectionName = 'Actions'
  299.     and c.SettingName = 'uSecAction'
  300.     and c.Value = '3'
  301.     )
  302.  
  303. /* ----------------------------------------------------------------------------
  304. [Spyware]                                                        [Spyware]
  305. uAction_Program                                = 3    (Move)        =>  = 4 (Delete)
  306. uSecAction_Program                                            =>  = 1 (Continue)
  307. ---------------------------------------------------------------------------- */
  308. update EPOTaskSettings
  309. set Value = '1'
  310. where
  311. SectionName = 'Spyware'
  312. and SettingName = 'uSecAction_Program'
  313. and EPOTaskSettings.parentid in 
  314.     (select b.parentid
  315.     from #VseTmpUpgradeTask, EPOTaskSettings b
  316.     where
  317.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  318.     and b.SectionName = 'Spyware'
  319.     and b.SettingName = 'uAction_Program'
  320.     and b.Value = '3'
  321.     )
  322.  
  323. update EPOTaskSettings
  324. set Value = '4'
  325. where
  326. SectionName = 'Spyware'
  327. and SettingName = 'uAction_Program'
  328. and EPOTaskSettings.parentid in 
  329.     (select b.parentid
  330.     from #VseTmpUpgradeTask, EPOTaskSettings b
  331.     where
  332.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  333.     and b.SectionName = 'Spyware'
  334.     and b.SettingName = 'uAction_Program'
  335.     and b.Value = '3'
  336.     )
  337.  
  338. /* ----------------------------------------------------------------------------
  339. [Spyware]                                                        [Spyware]
  340. uAction_Program                                = 5    (Clean)
  341. uSecAction_Program                            = 3    (Move)        =>  = 4 (Delete)
  342. ---------------------------------------------------------------------------- */
  343. update EPOTaskSettings
  344. set Value = '4'
  345. where
  346. SectionName = 'Spyware'
  347. and SettingName = 'uSecAction_Program'
  348. and EPOTaskSettings.parentid in 
  349.     (select b.parentid
  350.     from #VseTmpUpgradeTask, EPOTaskSettings b, EPOTaskSettings c
  351.     where
  352.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  353.     and b.SectionName = 'Spyware'
  354.     and b.SettingName = 'uAction_Program'
  355.     and b.Value = '5'
  356.     and b.ParentID = c.ParentID
  357.     and c.SectionName = 'Spyware'
  358.     and c.SettingName = 'uSecAction_Program'
  359.     and c.Value = '3'
  360.     )
  361.  
  362. /* ----------------------------------------------------------------------------
  363. [Spyware]                                                        [Spyware]
  364. uAction_Program                                = 4    (Delete)
  365. uSecAction_Program                            = 3    (Move)        =>  = 1 (Continue)
  366. ---------------------------------------------------------------------------- */
  367. update EPOTaskSettings
  368. set Value = '1'
  369. where
  370. SectionName = 'Spyware'
  371. and SettingName = 'uSecAction_Program'
  372. and EPOTaskSettings.parentid in 
  373.     (select b.parentid
  374.     from #VseTmpUpgradeTask, EPOTaskSettings b, EPOTaskSettings c
  375.     where
  376.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  377.     and b.SectionName = 'Spyware'
  378.     and b.SettingName = 'uAction_Program'
  379.     and b.Value = '4'
  380.     and b.ParentID = c.ParentID
  381.     and c.SectionName = 'Spyware'
  382.     and c.SettingName = 'uSecAction_Program'
  383.     and c.Value = '3'
  384.     )
  385.  
  386. /* ----------------------------------------------------------------------------
  387. [Actions]                                                        
  388. -szMoveToFolder
  389. -szSecMoveToFolder
  390. ---------------------------------------------------------------------------- */
  391. delete EPOTaskSettings 
  392. where 
  393. EPOTaskSettings.SectionName = 'Actions'
  394. and EPOTaskSettings.SettingName = 'szMoveToFolder'
  395. and EPOTaskSettings.parentid in 
  396.     (select b.parentid
  397.     from #VseTmpUpgradeTask, EPOTaskSettings b
  398.     where
  399.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  400.     )
  401.  
  402. delete EPOTaskSettings 
  403. where 
  404. EPOTaskSettings.SectionName = 'Actions'
  405. and EPOTaskSettings.SettingName = 'szSecMoveToFolder'
  406. and EPOTaskSettings.parentid in 
  407.     (select b.parentid
  408.     from #VseTmpUpgradeTask, EPOTaskSettings b
  409.     where
  410.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  411.     )
  412.  
  413. /* ----------------------------------------------------------------------------
  414. [Reports]                                                
  415. -bLogUsername
  416. ---------------------------------------------------------------------------- */
  417. delete EPOTaskSettings 
  418. where 
  419. EPOTaskSettings.SectionName = 'Reports'
  420. and EPOTaskSettings.SettingName = 'bLogUsername'
  421. and EPOTaskSettings.parentid in 
  422.     (select b.parentid
  423.     from #VseTmpUpgradeTask, EPOTaskSettings b
  424.     where
  425.     b.ParentID = #VseTmpUpgradeTask.VSE87AutoID
  426.     )
  427.     
  428. /* ----------------------------------------------------------------------------
  429. [Advanced]                                                
  430. bDeferScanOnBattery=0
  431. ---------------------------------------------------------------------------- */
  432. insert into EPOTaskSettings
  433. (ParentID, SectionName, SettingName, Value)
  434. select EPOTaskSettings.parentid, 'Advanced', 'bDeferScanOnBattery', 0
  435. from EPOTaskSettings, #VseTmpUpgradeTask
  436. where
  437. EPOTaskSettings.SectionName = 'Advanced'
  438. and EPOTaskSettings.SettingName = 'bDoHsm'
  439. and EPOTaskSettings.parentid = #VseTmpUpgradeTask.VSE87AutoID
  440.  
  441. /* ----------------------------------------------------------------------------
  442. [Advanced]                                                
  443. bDeferScanInFullScreen=0
  444. ---------------------------------------------------------------------------- */
  445. insert into EPOTaskSettings
  446. (ParentID, SectionName, SettingName, Value)
  447. select EPOTaskSettings.parentid, 'Advanced', 'bDeferScanInFullScreen', 0
  448. from EPOTaskSettings, #VseTmpUpgradeTask
  449. where
  450. EPOTaskSettings.SectionName = 'Advanced'
  451. and EPOTaskSettings.SettingName = 'bDoHsm'
  452. and EPOTaskSettings.parentid = #VseTmpUpgradeTask.VSE87AutoID
  453.  
  454. /* ----------------------------------------------------------------------------
  455. [Advanced]                                                
  456. uDeferTime=1
  457. ---------------------------------------------------------------------------- */
  458. insert into EPOTaskSettings
  459. (ParentID, SectionName, SettingName, Value)
  460. select EPOTaskSettings.parentid, 'Advanced', 'uDeferTime', 1
  461. from EPOTaskSettings, #VseTmpUpgradeTask
  462. where
  463. EPOTaskSettings.SectionName = 'Advanced'
  464. and EPOTaskSettings.SettingName = 'bDoHsm'
  465. and EPOTaskSettings.parentid = #VseTmpUpgradeTask.VSE87AutoID    
  466.  
  467. /* ----------------------------------------------------------------------------
  468. [Reports]                                                
  469. Alert_ExcludeCookies=1
  470. ---------------------------------------------------------------------------- */
  471. insert into EPOTaskSettings
  472. (ParentID, SectionName, SettingName, Value)
  473. select EPOTaskSettings.parentid, 'Reports', 'Alert_ExcludeCookies', 1
  474. from EPOTaskSettings, #VseTmpUpgradeTask
  475. where
  476. EPOTaskSettings.SectionName = 'Reports'
  477. and EPOTaskSettings.SettingName = 'bLogToFile'
  478. and EPOTaskSettings.parentid = #VseTmpUpgradeTask.VSE87AutoID
  479.  
  480. /* ----------------------------------------------------------------------------
  481. [Advanced]                                                
  482. dwHeuristicNetCheckSensitivity=0
  483. ---------------------------------------------------------------------------- */
  484. insert into EPOTaskSettings
  485. (ParentID, SectionName, SettingName, Value)
  486. select EPOTaskSettings.parentid, 'Advanced', 'dwHeuristicNetCheckSensitivity', 0
  487. from EPOTaskSettings, #VseTmpUpgradeTask
  488. where
  489. EPOTaskSettings.SectionName = 'Advanced'
  490. and EPOTaskSettings.SettingName = 'bDoHsm'
  491. and EPOTaskSettings.parentid = #VseTmpUpgradeTask.VSE87AutoID
  492. end
  493. go
  494.  
  495. if exists (select * from tempdb..sysobjects where name like '#VseTmpUpgradeTask%')
  496. drop table #VseTmpUpgradeTask
  497. go
  498.  
  499. /* ----------------------------------------------------------------------------
  500. Update the task timestamps
  501. ---------------------------------------------------------------------------- */
  502. if exists (select * from tempdb..sysobjects where name like '#vsetasktime%')
  503. drop table #vsetasktime
  504. go
  505.  
  506. begin
  507. -- Update the timestamps so that the agents know there are new tasks
  508. declare @Currenttime int
  509. select @Currenttime = @@dbts
  510.  
  511. update EPOTask set TheTimestamp = @Currenttime
  512. where ProductCode = 'VIRUSCAN8700'
  513.  
  514. select parentid as autoid, parenttype, max(thetimestamp)as maxtime
  515. into #vsetasktime
  516. from EPOTask
  517. where ProductCode = 'VIRUSCAN8700'
  518. group by parentid, parenttype
  519.  
  520. update EPOLeafNode
  521. set tasktimestamp = #vsetasktime.maxtime + 1
  522. from #vsetasktime
  523. where EPOLeafNode.autoid = #vsetasktime.autoid
  524. and #vsetasktime.parenttype = EPOLeafNode.type
  525.  
  526. update EPOBranchNode
  527. set tasktimestamp = #vsetasktime.maxtime + 1
  528. from #vsetasktime
  529. where EPOBranchNode.autoid = #vsetasktime.autoid
  530. and #vsetasktime.parenttype = EPOBranchNode.type
  531.  
  532. update EPOTaskSettings set TheTimestamp = @Currenttime
  533. from EPOTask
  534. where EPOTaskSettings.parentid = EPOTask.autoid
  535. and EPOTask.ProductCode = 'VIRUSCAN8700'
  536.  
  537. end
  538. go
  539.  
  540. if exists (select * from tempdb..sysobjects where name like '#vsetasktime%')
  541. drop table #vsetasktime
  542. go