SQL Clone 5

T-SQL clone modifications

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. 

Implementation notes

The scripts will be run with limited privileges - as a temporary user which only has permission to modify the image as db_owner, not to make changes to the server or to other databases.

Injected variables

SQL Clone automatically sets up some SQL variables that can be used by any T-SQL script modification during image creation.

  • @SQLClone_CloneName contains the name of the clone being created (e.g. 'MaskedProductionClone').
  • @SQLClone_MachineName contains the name of the machine hosting the agent that is creating the image (e.g. 'AGENTMACHINE01').
  • @SQLClone_UserName contains 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 EXEC sp_executesql.


Didn't find what you were looking for?