The following script will clear out an existing tenant from a solution.

Make sure that you take a backup before using SQL scripts on a Nathean Analytics database.

declare @TargetSystemCode varchar(20) = @TargetSystemCode
--erase from system


delete from TBL_GROUP_ATTRIBUTES where system_code = @TargetSystemCode
delete from TBL_NAVIGATOR_USER_PERMISSIONS where system_code = @TargetSystemCode
delete from TBL_NAVIGATOR_SERVICE_GROUP where system_code = @TargetSystemCode
delete from TBL_NAVIGATOR_PERMISSION where system_code = @TargetSystemCode
delete from TBL_NAVIGATOR_GROUP_PERMISSION where system_code = @TargetSystemCode
delete from TBL_NAVIGATOR where system_code = @TargetSystemCode

delete from TBL_FOLDER where system_code = @TargetSystemCode

delete from TBL_USER_DASHBOARD_ATTRIBUTE where system_code = @TargetSystemCode
delete from tbl_USER_SYSTEM where system_code = @TargetSystemCode
delete from TBL_OBJECT_META where system_code = @TargetSystemCode
delete from TBL_SELECT_AUDIT where system_code = @TargetSystemCode
delete from TBL_SELECT where system_code = @TargetSystemCode
delete from TBL_GUI_META where system_code =@TargetSystemCode
delete from TBL_OBJECT where system_code = @TargetSystemCode


delete from TBL_GROUP_ATTRIBUTES where system_code = @TargetSystemCode
delete from TBL_GROUP_CREDENTIALS where system_code = @TargetSystemCode
delete from TBL_GROUP_MEMBERSHIP where system_code = @TargetSystemCode
delete from TBL_PERMISSION_GROUP_USER where system_code = @TargetSystemCode
delete from TBL_PERMISSION_GROUP_GROUP where system_code = @TargetSystemCode
delete from TBL_DATA_CONNECTOR_GROUP_PERMISSIONS where system_code = @TargetSystemCode
delete from TBL_PERMISSION_GROUP where system_code = @TargetSystemCode

delete from TBL_PERMISSION_SET_COMPONENT where system_code = @TargetSystemCode
delete from tbl_group where system_code = @TargetSystemCode

delete from TBL_DATA_CONNECTOR_USER_PERMISSIONS where system_code = @TargetSystemCode
delete from TBL_DB_CONNECTION where system_code = @TargetSystemCode

delete from TBL_PERMISSION_SET where system_code = @TargetSystemCode

delete from TBL_DASHBOARD_LAYOUT_ZONE where system_code = @TargetSystemCode
delete from TBL_DASHBOARD_LAYOUT where system_code = @TargetSystemCode


delete from TBL_CHART_SERIES_PROPERTIES where system_code = @TargetSystemCode
delete from TBL_CHART_SERIES where system_code = @TargetSystemCode
delete from TBL_CHART_PROPERTIES where system_code = @TargetSystemCode
delete from TBL_CHART_TEMPLATES where system_code = @TargetSystemCode

delete from TBL_DB_CONNECTION where system_code = @TargetSystemCode
delete from tbl_user_system where system_code = @TargetSystemCode

delete from tbl_system where system_code = @TargetSystemCode
Revision: 3
Last modified: Jun 22, 2020

Feedback

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.

Post your comment on this topic.

Post Comment