Forum Discussion

kevman's avatar
kevman
Occasional Contributor
11 years ago

parse SQL failed in Data source with = or "

Hi,

I'm creating data source with JDBC or Data connection.
Recently I got a parsing error because of using SQL function with =.

For example, the following query will fail by =.


select IIF(typeid=1, 'Y', 'N') as boolean from table


Is there any way to use those functions in sql query or using wizard?

7 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    I'd like to have some more information. = should work just fine. What database are you using? What is the parsing error you're getting?

    Regards,
    Arian
    SmartBear sweden
  • kevman's avatar
    kevman
    Occasional Contributor
    Hi,

    I'm using MS SQL 2012 Ent. with MicrosoftDriver (com.microsoft.sqlserver.jdbc.SQLServerDriver). (SOAPUI Pro 4.5.2)
    And I got this error.

  • kevman's avatar
    kevman
    Occasional Contributor
    Hi, I noticed that if I add properties by manual, then the task just passed.
    It fails when you try to rebuild with 'Build Query' wizard.


    Select IIF(Injury= 1, 'Yes','No') as Test
    From
    dbo.Injury Where PatentID= 1
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    kevman wrote:
    Hi, I noticed that if I add properties by manual, then the task just passed.
    It fails when you try to rebuild with 'Build Query' wizard.


    Select IIF(Injury= 1, 'Yes','No') as Test
    From
    dbo.Injury Where PatentID= 1

    Interesting!

    Can you please show the two versions of the query? I.e. the one that works (manually written) and the one that doesn't (generated by the SQL wizard).

    Regards

    Henrik O
    SmartBear Software
  • kevman's avatar
    kevman
    Occasional Contributor
    I meant if I use same query, but just paste and create 'Property' (in top red box), then it just works.
    However, if I use 'Build Query' option (bottom red) to create properties and modify query in SOAPUI, then I'll get a parse error.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    We are pretty sure SoapUI is not failed when parsing SQL query with = or ''. Did you try the other SQL query with = or '' other than the IIF statement?
    If the problem still exist, please let us know.

    Regards,
    Li
    SmartBear Sweden