Skip to main content
Solved

IF statement based on published parameter SQLCreator

  • March 6, 2023
  • 1 reply
  • 18 views

dustin
Influencer
Forum|alt.badge.img+31

In a SQLCreator, I want to return the records from a specific table, if a certain choice is made in a parameter. I have a published parameter "check_choice", that is a Choice Multiple Parameter.  In this example, I want to return table records from BUILT_UP_AREA_S if 'BUA_Road_RTY' is selected in the parameter. The database type is Microsoft SQL Server Non-Spatial (JDBC) in my SQLCreator. The statement below results in an error Incorrect syntax near ','. 

 

What am I doing incorrectly in this statement?

IF($(check_choice) LIKE "%BUA Road RTY%",SELECT * FROM dbo.[BUILT_UP_AREA_S])

 

Best answer by dustin

Turns out I was over-complicating. The statement I was looking for was:

SELECT * FROM dbo.[BUILT_UP_AREA_S] WHERE '$(check_choice)' LIKE '%BUA%'

 

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

1 reply

dustin
Influencer
Forum|alt.badge.img+31
  • Author
  • Influencer
  • 629 replies
  • Best Answer
  • March 6, 2023

Turns out I was over-complicating. The statement I was looking for was:

SELECT * FROM dbo.[BUILT_UP_AREA_S] WHERE '$(check_choice)' LIKE '%BUA%'