Trying to tidy up my SQL script with SQLCMD mode and I ran into an issue:
:setvar db_suffix "some_suffix"
:setvar some_db "some_db_$(db_suffix)"
print 'some_db: $(some_db)'
The output of that is:
some_db: some_db_$(db_suffix)
However, what I expected was:
some_db: some_db_some_suffix
Is there a way to have variable interpolation like this?
(Note that T-SQL functions such as CONCAT()
won't work since I'll be using the variable as a database name).