andw928
asked on
Not escaping a mysql variable within a string.
I have the following query:
SELECT @test := 'hello', CONCAT('Message: @test', column_name)
The problem is that this displays "Message: @test", instead I want to display the variable @test that I set right before it, although, I do NOT want to put it seperately like this:
CONCAT('Message:', @test, column_name)
Is there anyway to evaluate a variable enrapped inside quotes without seperating it from the rest of the string so that it shows its value?
SELECT @test := 'hello', CONCAT('Message: @test', column_name)
The problem is that this displays "Message: @test", instead I want to display the variable @test that I set right before it, although, I do NOT want to put it seperately like this:
CONCAT('Message:', @test, column_name)
Is there anyway to evaluate a variable enrapped inside quotes without seperating it from the rest of the string so that it shows its value?
No. Why don't you want to list it separately?
It is not doing what it should because how it can distinguish whether you want a variable substitution or the string in itself (i.e. @test in this case). By putting it inside the quotes ' ', you are making it a string.
ASKER
snoyes, because I am passing a coldfusion function which can't be seperated.
kupra1, you did not read my entire post.
Does anybody else have a possible solution?
kupra1, you did not read my entire post.
Does anybody else have a possible solution?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You are a genius my friend, it works well, thank you!