SQL Command

Set of SQL Statements or Batches separated by go ("go" in a new line by itself).

Example:

use master

select @@version

select @@servername

go

select getdate()

go

It is possible to execute dynamic statement by substituting values at runtime by using “Substitute Values” under “Workload Settings”. For example, the following batch can be executed for 10 iterations each time @i begin substituted values from 1 to 10 and @j begin substituted values from 100 to 110.

usetest

selectc1,c2,c3fromtab71wherec1=@i

go

selectc1,c2,c3fromtab72wherec1=@j

go

Under SQL Profiler trace or Extended Events, the actual statement will be as follows

usetest

selectc1,c2,c3fromtab71wherec1=1

go

selectc1,c2,c3fromtab72wherec1=100

go

usetest

selectc1,c2,c3fromtab71wherec1=2

go

selectc1,c2,c3fromtab72wherec1=101

go

...

usetest

selectc1,c2,c3fromtab71wherec1=10

go

selectc1,c2,c3fromtab72wherec1=110

go

Instead of substituting values, one can also parameterize the statements by using “Parameterize Query” under “Workload Settings”.

It is possible to perform find and replace in SQL command during runtime by enabling “Allow Find and Replace In SQL Statement” and providing “Find and Replace (Pattern=Replacement)“ in “General Settings”.

In addition, one can use the following predefined pattern substitution:
{SQLTest_Workload} - Substitutes workload number.
{SQLTest_Connection} - Substitutes connection number.
{SQLTest_Thread} - Substitutes thread number.
{SQLTest_Iteration} - Substitutes iteration number.
{SQLTest_BatchIndex} – Substitutes batch index or batch number, batches are separated by go.
{SQLTest_Random_Digit} – Substitutes a random digit (single numeric number).
{SQLTest_Random_Character} – Substitutes a random character.
{SQLTest_Random_GUID} – Substitutes a random Guid / UniqueIdentifier.

Please help us improve this page by entering your comments and suggestions below:


  • Captcha image