-- RODBs
SELECT RODBID, ROName, FolderPath From RODBS
-- ROFSTs
Select ROFSTID, RODBID, DTS, len(ROLookup) Size, len(ROLookup)/1024 KBS from ROFSTS
-- Associations
Select AA.ROFSTID, RF.RODBID, DV.VersionID, FF.Name
from associations AA
Join ROFSTS RF ON AA.ROFSTID = RF.ROFSTID
Join DocVersions DV ON DV.VersionID = AA.VersionID
Join Folders FF ON Dv.FolderID = FF.FolderID
--
select RODBID,Count(*) HowMany from ROUSages Group by RODBID
select RODBID,Count(*) HowMany from DROUSages Group by RODBID
select ImageID, RODBID,FileName from ROIMAGES
select FF.ImageID, RODBID from Figures FF Join ROImages RI ON RI.ImageID = FF.ImageID
/*
--Update RODBs Set FolderPath = 'C:\Plant\VEHLP\RO' where RODBID = 1
Update Associations Set ROFSTID = 4 
delete from Figures where ROFSTID != 4
DELETE From ROFSTS where ROFSTID != 4
update roFSTs set RODBID = 1
Update ROUSages set RODBID =1 where RODBID=2
Update Contents Set Text = Replace(TEXT,' 2[END>',' 1[END>') where Text like '% 2\[END>%' escape '\'
Update DROUSages set RODBID =1 where RODBID=2
Update ROImages set RODBID=1 where RODBID=2 and FileName Not In (Select FileName from roimages where RODBID=1)
Update FF Set FF.ImageID = (select ImageID from ROImages RI1 where RI1.RODBID=1 and RI.FileName = RI1.FileName)   
	from Figures FF join ROIMages RI ON FF.ImageID = RI.ImageID Where RODBID = 2
DELETE ROImages where RODBID=2
Delete RODBs Where RODBID = 2
*/