If you have the
following SQL query that uses Common Table Expression (CTE), you will see the
error after trying to populate the data in SOAtest.
DECLARE @PolicyName varchar(20)='%Glucose%'
…
; WITH CTE as
(
SELECT field1, field2
from Policy PO WITH(NOLOCK)
WHERE field1 like
@PolicyName
)
The following error shows up in XML data bank
after running the test.
When I see this error, I
feel so surprised because this SQL query is always working in SQL Server 2008
R2, but SOAtest complains about it using CTE.
How to solve this issue? We need to declare this variable in SOAtest.
- Double Click Scenario
- Click Variables and add PolicyName like this
3.Modify
the following SQL query
; WITH CTE as
(
SELECT field1, field2
from Policy PO WITH(NOLOCK)
WHERE field1 like '${PolicyName}’
)
After running the test, the
variable will be passed to SQL query in CTE and the test will pass without any
issue.
No comments:
Post a Comment