I took a look at that stored procedure, it looks like it only updates the xrefs table if it encounters a shared file, so it looks like it thinks you're deleting a shared file that exists in that folder but it doesn't know where that shared file also exists in the vault so it's trying to set the projectid to null which isn't allowed. It's specifically looking for the value "documents.Shared > 0" as a flag for that file having multiple locations so something might have gotten out of sync and it doesn't have multiple copies anymore. You'll have to do some digging into your own data to figure out what happened but I see you works for SolidWorks so be sure to report the bug when you find it
I think he used his special SolidWorks employee powers to delete his post, but it left my comment behind haha. It was a question about trying to destroy a folder and it throwing an error about inserting null in the projectid field of the xrefs table.
I took a look at that stored procedure, it looks like it only updates the xrefs table if it encounters a shared file, so it looks like it thinks you're deleting a shared file that exists in that folder but it doesn't know where that shared file also exists in the vault so it's trying to set the projectid to null which isn't allowed. It's specifically looking for the value "documents.Shared > 0" as a flag for that file having multiple locations so something might have gotten out of sync and it doesn't have multiple copies anymore. You'll have to do some digging into your own data to figure out what happened but I see you works for SolidWorks so be sure to report the bug when you find it