SQL-Server-Scripts
SQL-Server-Scripts copied to clipboard
IDEA: Keeping tables and using TRUNCATE
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