This procedure allows you to generate an insert statement for a table, based on a particular row in that table. We made this procedure flexible: you can enter in the name of any Minion table, and a row ID, and it will generate the insert statement for you.
Note that this function is shared between Minion modules.
WARNING: This generates a clone of an existing row as an INSERT statement. Before you run that insert, be sure to change key identifying information - e.g., the DBName - before you run the INSERT statement; you would not want to insert a completely identical row.
Name | Type | Description |
---|---|---|
@TableName | Varchar |
The name of the table to generate an insert statement for.
Note: This can be in the format "Minion.CheckDBSettingsDB" or just " CheckDBSettingsDB". |
@ID | Int |
The ID number of the row you'd like to clone. See the discussion below. |
@WithTrans | Bit |
Include “BEGIN TRANSACTION” and “ROLLBACK TRANSACTION” clauses around the insert statement, for safety. |
Discussion
Because of the way we have writte Minion CheckDB, you may often need to insert a row that is nearly identical to an existing row. If you want to change just one setting, you still have to fill out 40 columns. For example, you may wish to insert a row to Minion.CheckDBSettingsDB that is only different from the MinionDefault rows in two respects (e.g., DBName and GroupOrder).We created Minion.CloneSettings to easily duplicate any existing row in any table. This "helper" procedure lets you pass in the name off the table you would like to insert to, and the ID of the row you want to model the new row off of. The procedure returns an insert statement so you can change the one or two values you want.