Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
Hello,
Is there a way to use SQL queries to delete all the WTPARTs and clean up all the related links tables?
Some articles state that this is possible through purge and link removal, but can this be done through the DB?
Full WTPart deletion from Windchill is doable for sure but I would do this in Java rather than SQL script.
I have a Java tool that companies have requested I write for them to do similar cleanups.
I know this can be achieved through Java coding using APIs. However, with a proper setup and DB knowledge, this could be executed quickly through the DB scripts.
Is time a crticial requirement means is this part of some planned event or downtime? Or are you looking to remove and move on? There are so many places where Parts can be referenced in related tables. Either Java or SQL would need to account for them all and there is a risk it misses some. Curious as to why you are looking to delete all.
I've done the manual approach. Its difficult since you get blocked if a Part is called out by another Part. I eventually was able to clear out thousands of records but it was very repetative and tedious. However, it was safe. Using supported UI methods, integrity was maintained.
This needs to be done in one go through a script. The reason is that the parts created for CAD are messy and not lined up correctly. As you rightly pointed out, doing it through the UI is very tedious but safe. It is possible through Java APIs, and I have renamed/edited in bulk before, but this method also requires coding. With proper database knowledge and SQL scripts, this can be achieved quickly.
What's your total part count? Recommend running purge scripts if possible to reduce the issue with historical iterations cause blocks. @d_graham might have a solution for you.
OK, is that particular tool free and part of the Windchill framework?