i'm trying join strings define path - example, given $(name) = "path", want :r .\pathone\path.sql
. query fails @ first :r
due syntax error
. if hardcode paths, , leave $(name)
in conditionals, works expected. it's string construction path that's failing reason.
if '$(name)' 'test%' begin :r .\pathone\'$(name)'.sql end if '$(name)' not 'test%' begin :r .\pathtwo\'$(name)'.sql end
how go joining strings path in sql? naming files directly works.
enclose hardcoded parts of path inside double quote , variables without space next hardcoded part constructing path, example
:setvar filename "test" :setvar root "d:\temp" :r $(root)"\test\"$(filename)".sql"
will result in path like
d:\temp\test\test.sql
to resolve problem try this
:r ".\pathone\"$(name)".sql"
hope helps