Query Customization

The program supports dynamic statements as well as static statements. Their final state will be defined at the moment of execution. To make it possible, special tags (like ?1, ?2, etc.) are inserted into the text of a statement. Those tags will be replaced with the values from the values file. They are always replaced, even inside string constants.

Important: all symbols after '=' are significant. For example, any space is a part of value: ?2= 7 means ' 7' not '7'.

The file with values is a text file. Each line in it corresponds to one value (?n). If there are more tags than values, tags with bigger numbers will not be replaced with any values.

There is sample value file content and parameters resolving results:

Parameters Source Query Resolved SQL
?1=Sam Foxy
?2=ShippingDate
?3=2015-01-01
select * from Orders
where CustomerName='?1' and OrderDate<'?3'
order by ?2
select * from Orders
where CustomerName='Sam Foxy' and OrderDate<'2015-01-01'
order by ShippingDate

Note: $DATE$ and $TIME$ macros can also be used as a part of the SQL script or statement.

DTM Query Reporter: parameters definition page