I'm trying to join some strings together to define a path - for example, given $(name) = "PATH", I want :r .\PathOne\PATH.sql. The query fails at the first :r due to Syntax Error. If I hardcode the paths, and leave $(name) in the conditionals, it works as expected. It's just the string construction for the path that's failing for some reason.
IF '$(name)' LIKE 'TEST%'
BEGIN
:r .\PathOne\'$(name)'.sql
END
IF '$(name)' NOT LIKE 'TEST%'
BEGIN
:r .\PathTwo\'$(name)'.sql
END
How do I go about joining strings for a path in SQL? Naming the files directly works.
IF '$(name)'works just as I want it to. I just can't get the string paths working.