SMS SQL for Duplicate Collection Names

Recently, I've found many collections with duplicate names. The dupes can cause problems when managing those collections. I quickly created the following SQL to find the offending collections.

-- This SQL query will show collections with duplicate names.

Select parentCollectionID, ParentCollection.Name, v_Collection.CollectionID, v_Collection.Name from v_Collection
left outer join
v_CollectToSubCollect
on v_Collection.collectionid=v_CollectToSubCollect.subcollectionid
left outer join
v_Collection ParentCollection
on v_CollectToSubCollect.parentCollectionID = ParentCollection.collectionid
where v_Collection.Name in (Select Name from v_Collection Group By Name Having Count(*)>1)

Comments

Popular posts from this blog

SMS "Program failed (run time exceeded)" 10070

SMS "Waiting for User Condition" 10036

SMS "Waiting for content" 10035