I run into this problem while working on VA's parameterized query feature.
According to AFParameterParser's document, quotes can be part of a parameter name as long as quote is escaped with backslash. But this does not seems to work in Query Analyzer, below are steps to reproduce the problem using 15.0.7-23 build:
(1) Open a Query Analyzer to SQL Server running on xxx.xxx.11.54 with database = Northwind, schema = dbo
(2) Type the following query in the opened Query Analyzer window and execute it:
select * from Orders where OrderID = 10248
--> One row is retrieved from the server
(3) Modify above query and replaced 10248 with &"param\'s name", i.e. the query becomes
select * from Orders where OrderID = &"param\'s name"
(4) In query panel's toolbar, click "Parameterized Script" icon (the last icon) to turn it on.
(5) Execute the query
--> Parameters dialog pops up
. Name column: param\'s name
. Value column: empty
--> Type in 10248 in Value column and click Execute button.
==> Query is executed with the following message displayed in the Messages tab:
>•[Error] •Script lines: 10-11 ----------------------
Line 1: Incorrect syntax near '='.
•Msg: 170, •Level: 15, •State: 1, •Procedure: , •Line: 1
•[Executed: 10/6/2014 2:26:03 PM] [Execution: 14•ms]
It seems that parameter is not substituted correctly with user provided value.
@Niels - Using the query:
select * from Orders where OrderID = &"param\'s name"
I think Andy(?) changed this a while back (issue #5802). There are two issues:
1. The listNameValue in AFParameterParser gets the "param\'s name" (notice escape character '\' not removed), this shows up in the Parameter Dialog UI
2. In subsequent call to setParameter(Map nameValue), the nameValue map contains two entries:
"param\'s name" -> "10248"
"param's name" -> ""
Hence we are substituting "param's name" with an empty string.
Issue #12541 |
| Closed |
Completion |
| No due date |
| No fixed build |
| No time estimate |
1 issue link |
is broken by #5802
Issue #5802Add support for remembering last parameterized variable value per execution |
@Niels - Using the query:
select * from Orders where OrderID = &"param\'s name"
I think Andy(?) changed this a while back (issue #5802). There are two issues:
1. The listNameValue in AFParameterParser gets the "param\'s name" (notice escape character '\' not removed), this shows up in the Parameter Dialog UI
2. In subsequent call to setParameter(Map nameValue), the nameValue map contains two entries:
"param\'s name" -> "10248"
"param's name" -> ""
Hence we are substituting "param's name" with an empty string.