I have the next script example:
DECLARE @lCode INT
DECLARE @lText VARCHAR(400)
DECLARE @lConditionName VARCHAR(40)
DECLARE @Aux VARCHAR(400)
SET @lCode = 1234;
SET @lConditionName = 'Code'
SET @Aux = '@l' + @lConditionName
SET @lText = 'SELECT * FROM Table WHERE Code = ' + @Aux
PRINT @lText
The result is:
SELECT * FROM Table WHERE Code = @lCode
How can i obtein the value of @Aux Var like this?
SELECT * FROM Table WHERE Code = 1234