Skip to content


Variable use in SQL statement

Brian asked 9 years ago
I want to execute a SQL statement after the successful completion of each document.  I need to reference the value of a user global variable in the SQL statement.  I'm trying to assign the values to a SQL variable.

Declare @GblVar as char(5)
Set @GblVar = GBL_TESTA

If I exclude the ' around the variable name I get an error Invalid column name 'GBL_'. 
If I enclose the variable in ' the @GblVar gets assigned the string GBL_TESTA.

How do I reference the value of GBL_TESTA in the SQL statement?
Best Answer
Chris answered 9 years ago
Brian, it looks like there is something that doesn't work with that variable as I got the same result. I made a new variable just called GBL_MYVAR (under the Maintenance tab in SmartConnect) and used that in hte same statement and it worked as expected.


If you would like to submit an answer or comment, please sign in to the eOne portal.