EnVisageOnline/Main-RMO/Database/Scripts/20150525/01_DeleteOldSystemCapacitie...

16 lines
389 B
Transact-SQL

use EnVisage
go
declare capdelete cursor for select parentid from Scenario where type = 5
declare @projectId uniqueidentifier
open capdelete
fetch next from capdelete into @projectId
while @@FETCH_STATUS = 0
begin
delete from ProjectAccess where ProjectId = @projectId
exec sp_DeleteProject @projectId
fetch next from capdelete into @projectId
end
close capdelete
deallocate capdelete