declare @ParentFolderID int
set @ParentFolderID =81
Delete From Associations where VersionID in(select versionid from DocVersions where folderid in (select folderid from Folders where ParentID = @ParentFolderID))
Delete From DocVersions where VersionID in(select versionid from DocVersions where folderid in (select folderid from Folders where ParentID = @ParentFolderID))
delete From Folders where ParentID=@ParentFolderID
delete from Folders where folderid=@ParentFolderID