JohnO'Mullane

SQL Variable - Using a UNION - Not working when called via Prompt from Script

Discussion created by JohnO'Mullane on Nov 15, 2016
Hi all,
I have created a SQL Variable which brings back a list of databases. I will be using this variable as part of a Prompt attached to a Script.

I also want to pass in the value 'ALL' to allow me take a different course of action when this value is picked.

The SQL Variable seems to work fine, my preview displays all the Databases + 'ALL'

fo0pi18cnvth.png

However, when I then execute my script that is calling this Prompt and pick one of the Databases on the list, I'm getting the error below.

If I remove my UNION code, the Script runs successfully, passing the Database value into my script.
laib2uptnyvf.png

Has anyone out there seem a problem with using a UNION within a SQL variable before??

John.

Outcomes