On 02/06/2008, aidy lewis <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  In a JDBC request, is it possible to use variables in the sql query?
>
>  I have a file
>
>  15004781
>  15004782
>  15004783
>  15004784
>  15004785
>  15004786
>  15004787
>  15004788
>  ....
>
>  That I read in the CSV data set config. The var has been assigned to
>  the name 'contractid'
>
>  Now, I know I can use this var in Jmeter like this; ${contractid}
>
>  But, how could I use this in my sql?
>
>  declare @contractId int,
>
>  set @contractId = 15004779
>

If you are referring to SQL in the JDBC sampler, then just put:

set @contractId = ${contractid}

However, I assume you are referring to a stored procedure.

In which case, you need to pass the variable in as a parameter to the
stored procedure, and use whatever the SQL dialect requires to refer
to the parameter.

The JDBC Sampler would look something like:

{CALL PROCEDURE(${contractid})}

or, if using a prepared statement:
{CALL PROCEDURE(?)}
and then add ${contractid} as a variable at the bottom.

The enclosing {} may not be necessary.

See 
http://jakarta.apache.org/jmeter/usermanual/component_reference.html#JDBC_Request

>  Thanks
>
>  Aidy
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to