Okay this should be possible; if the injection is working correctly. What I am trying to do, is have a sqlcmd variable inject its value into another sqlcmd variable. Any ideas what I'm doing wrong ?
(Hint copy into SSMS, and select Query -> SQLCMD mode to run this)
:SETVAR DB_NAME_ASSIGN "TEST TEXT"
:SETVAR DB_NAME_TEXT "EXPECT INSERT OF DB_NAME_ASSIGN HERE: $(DB_NAME_ASSIGN)"
SELECT '$(DB_NAME_TEXT)' AS OUTPUT
SELECT '$(DB_NAME_ASSIGN)' AS OUTPUT
/*Expect DB_NAME_TEXT OUTPUT to be:*/
/* DB_NAME_TEXT "EXPECT INSERT OF DB_NAME_ASSIGN HERE: TEST TEXT*/
/*Unfortunatly I get : EXPECT INSERT OF DB_NAME_ASSIGN HERE: $(DB_NAME_ASSIGN)*/
Any ideas what I can do to get this to work (as I kind of need nested variable injection - nothing in BOL saying its not supported, possibly a bug)?
[SQL 2008 SP1 Dev Edition]