SQL-Server-Scripts icon indicating copy to clipboard operation
SQL-Server-Scripts copied to clipboard

IDEA: Keeping tables and using TRUNCATE

Open JoyWorksToo opened this issue 1 year ago • 0 comments

I run sp_DBPermissions from my own DB keeping and purge data as needed.

Right now I need to drop the tables before I re-run each time.

So can a new parameter be created @KeepTables

  @KeepTables
       If this parameter  is not NULL  @DropTempTables will be ignored.
       When this is NULL  (the default) the temp tables used are dropped. 
       DBA.dbo. - then the temp tables are kept for references after the code has finished and TRUNCATE will be ran at for each table at 
       start of next run
       The temp tables would be:
           DBA.dbo.DBPrincipals
           DBA.dbo.DBRoles 
           DBA.dbo.DBPermissions

JoyWorksToo avatar May 08 '24 19:05 JoyWorksToo