Variable use in SQL statement
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?
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?
Answers