Setting up project options in ApexSQL Clean

Applies to
ApexSQL Clean

Summary
This article describes how to set project options in ApexSQL Clean when starting a new project.

Description

Setting up project options

A project in ApexSQL Clean contains the server login information, and details such as which objects, projects, and databases are included in the dependency analysis.

To set project options start in the New project dialog under the Options tab of select or uncheck the following options:

Customizing project options under options tab in Project dialog

Ignore trigger reference to parent table – You may not want to consider triggers as an external reference to the parent table. This option allows the user to ignore the triggers, when the option is selected the clean script will drop only the table and the triggers will be dropped automatically.

Include transaction handling in drop script – This option includes error handling statements and a ROLLBACK/COMMIT statements depending on the success of the script execution. For example, if the Include transaction handling in drop script option is not selected the clean script will have the following DROP statement:

DROP TRIGGER [Production].[uWorkOrder]
GO

When the option is selected any error in the clean script will cause the statements to be parsed only and the executed statements to be rolled back:

DROP TRIGGER [Production].[uWorkOrder]
GO

IF @@ERROR<>0 OR @@TRANCOUNT=0 
BEGIN
	
	IF @@TRANCOUNT>0
		BEGIN
			ROLLBACK
		END
	SET NOEXEC ON
END
GO
IF @@TRANCOUNT>0
COMMIT
GO

Script header – This option defines if a script header will be included in the clean script. A script header contains information about the script’s location on the disk, a list of deleted objects, description, notes, author and company information, and a date of the script creation.

Script created after setting project options in ApexSQL Clean

To add author and company information to the script header when you finish setting up project options in the Project dialog, click OK. In the Results grid select the Options button from the Tools menu.

In the Options dialog under the General tab enter the author’s name and company:

Setting authorship info in ApexSQL Clean with options dialog under general tab

Comments – This option adds a comment prior to each statement block, describing its action and object type if available (drop object, backup database, restore database, etc.) e.g.:

-- DROP TRIGGER [Production].[uWorkOrder]
DROP TRIGGER [Production].[uWorkOrder]
GO

PRINT statement – This option will include the PRINT statements in the clean script:

IF @@ERROR<>0 OR @@TRANCOUNT=0 
BEGIN
	PRINT 'Error Occurred when dropping TRIGGER: [Production].[uWorkOrder]'
	IF @@TRANCOUNT>0
		BEGIN
			ROLLBACK
		END
	SET NOEXEC ON
END
ELSE PRINT 'TRIGGER [Production].[uWorkOrder] DROPPED'