Skip to main content
Solved

How to remove all traces of a package from the SQL Database?

  • February 5, 2025
  • 1 reply
  • 25 views

Forum|alt.badge.img

We have a request from someone who would like an SQL backup of their data to give to an analyst to run Power BI on it.

We will be doing a backup in SQL Server Management Studio, and FTPing a .BAK file.

We don’t want them having access to any of the customizations that we have written and published. So, we need to remove them from the SQL Server database. 

Where do I need to go to scrub all of the published data. I know I need to remove any usr field we have added. I already have a script for that. I need the rest of it.

Just looking in the database file, I see:

CustProject which has a structure of:

      [CompanyID]
      ,[ProjID]
      ,[Name]
      ,[IsWorking]
      ,[Description]
      ,[CertificationStatus]
      ,[CertificationWarning]
      ,[CertificationStatusDateTime]
      ,[DevelopedBy]
      ,[Hash]
      ,[CreatedByID]
      ,[CreatedDateTime]
      ,[LastModifiedByID]
      ,[LastModifiedDateTime]
      ,[ParentID]
      ,[tstamp]
      ,[Level]
      ,[NoteID]
      ,[SnapshotID]
 

But that doesn’t contain all of the data. 

When I check for any matching NoteID, I also find the file:

SearchIndex

But that doesn't seem to contain the data either. So I think there is another file somewhere, but I can’t seem to find it.

Does anyone know?

Best answer by Django

I found this answer over at SO:

https://stackoverflow.com/a/45491758/9542263

https://stackoverflow.com/questions/45490932/does-the-customization-project-exist-in-the-database

This query will show you the files:

SELECT CustProject.Name as CustomizationProjectName, 
       CustObject.Name as CustomizationItemName, 
       cast(UploadFileRevision.Data as varchar(max)) as TextFile, 
       UploadFileRevision.Data as BinaryFile 
FROM CustProject
JOIN CustObject ON CustObject.ProjectID = CustProject.ProjID AND
                   CustObject.Type = 'File'
JOIN NoteDoc on NoteDoc.NoteID = CustObject.NoteID
JOIN UploadFile ON UploadFile.FileID = NoteDoc.FileID
JOIN UploadFileRevision ON UploadFileRevision.FileID = UploadFile.FileID AND
                           UploadFileRevision.FileRevisionID = UploadFile.LastRevisionID

 

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+6
  • Captain II
  • 572 replies
  • Answer
  • February 5, 2025

I found this answer over at SO:

https://stackoverflow.com/a/45491758/9542263

https://stackoverflow.com/questions/45490932/does-the-customization-project-exist-in-the-database

This query will show you the files:

SELECT CustProject.Name as CustomizationProjectName, 
       CustObject.Name as CustomizationItemName, 
       cast(UploadFileRevision.Data as varchar(max)) as TextFile, 
       UploadFileRevision.Data as BinaryFile 
FROM CustProject
JOIN CustObject ON CustObject.ProjectID = CustProject.ProjID AND
                   CustObject.Type = 'File'
JOIN NoteDoc on NoteDoc.NoteID = CustObject.NoteID
JOIN UploadFile ON UploadFile.FileID = NoteDoc.FileID
JOIN UploadFileRevision ON UploadFileRevision.FileID = UploadFile.FileID AND
                           UploadFileRevision.FileRevisionID = UploadFile.LastRevisionID

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings