T-SQL clone modifications
Published 24 May 2018
As of version 2.6.1, you can provide SQL Clone with T-SQL scripts to run during clone creation.
Whilst SQL Clone creates the clone, the working agent will run your scripts.
SQL Clone automatically sets up some SQL variables that can be used by any T-SQL script modification during image creation.
@SQLClone_CloneNamecontains the name of the clone being created (e.g. 'MaskedProductionClone').
@SQLClone_MachineNamecontains the name of the machine hosting the agent that is creating the image (e.g. 'AGENTMACHINE01').
@SQLClone_UserNamecontains the username of the user who created the image (e.g. 'DOMAIN\Username').
If there is any other information you would find useful as an auto-injected SQL variable, let us know.
Statements that have to be run in their own query batch, such as
CREATE PROCEDURE and
ALTER PROCEDURE, don't have these variables injected, as SQL Server doesn't support passing in variables for these statements. If you want to use the injected variables, build up the SQL in a variable and use