This commit is contained in:
49
PROMS/SQL Data Tools/CleanupROUsagesGinna.SQL
Normal file
49
PROMS/SQL Data Tools/CleanupROUsagesGinna.SQL
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
VersionID : 6 Enhanced Background Documents
|
||||
RofstID : 24 2013-02-25 17:43:44.000
|
||||
RODBIDs : 3 RO D:\DATA\DDRIVE\VERGE\RO 97
|
||||
|
||||
RODBID Change from 3 to 1
|
||||
*/
|
||||
EXECUTE [vesp_TurnChangeManagerOFF]
|
||||
GO
|
||||
-- Contents - replacing rodbid's in content records' link text, for the input version
|
||||
update contents set text = replace(text, ' 3[END>', ' 2[END>')
|
||||
where contentid in (
|
||||
select vi.contentid from vefn_getversionitems('6') vi
|
||||
join rousages ru on ru.contentid = vi.contentid
|
||||
where ru.rodbid = 3)
|
||||
|
||||
-- Grids - replacing rodbid's in grid records' link text
|
||||
update grids set data = cast(replace(cast(data as nvarchar(max)), ' 3[END>', ' 2[END>') as xml)
|
||||
where contentid in (
|
||||
select vi.contentid from vefn_getversionitems('6') vi
|
||||
join rousages ru on ru.contentid = vi.contentid
|
||||
where ru.rodbid = 3)
|
||||
|
||||
-- ROUsages - updating rousage records with correct rodbid
|
||||
update rousages set rodbid = 2
|
||||
where rodbid = 3 and contentid in (
|
||||
select vi.contentid from vefn_getversionitems('6') vi
|
||||
join rousages ru on ru.contentid = vi.contentid
|
||||
where ru.rodbid = 3)
|
||||
|
||||
-- DROUsages - updating rousage records with correct rodbid
|
||||
update drousages set rodbid = 2
|
||||
where rodbid = 3
|
||||
|
||||
-- ROFSTs - Update RODBID to 2 from 3
|
||||
update rofsts set rodbid = 2 where rodbid = 3
|
||||
|
||||
-- Associations - No Change
|
||||
-- ROImages - No Change
|
||||
-- Figures - Insert duplicate records for figures
|
||||
INSERT INTO [Figures] ([ROFstID],[ImageID],[Config],[DTS],[UserID])
|
||||
select 24,[ImageID],[Config],[DTS],[UserID] from [Figures] where ROFSTID = 23
|
||||
-- Remove unused RODBs
|
||||
Delete RODBs Where RODBID = 3
|
||||
GO
|
||||
EXECUTE [vesp_TurnChangeManagerON]
|
||||
GO
|
||||
|
||||
|
Reference in New Issue
Block a user