1

I'm working with a Database Projecto to deploy databases using "Data pack"

I've set up a paramenter "client", so depending the client I'll run a different set of scripts.

I tried different options, but nothing worked.

I've checked out Conditional logic in PostDeployment.sql script using SQLCMD but no luck

if '$(client)' = 'a' 
:r .\GeneralParams\s01.sql 
:r .\Clients\a\a01.sql 

GO

if '$(client)' = 'b'
:r .\GeneralParams\r01.sql
:r .\Clients\b\b01.sql

Inside every external scripts there are more than 1 GO When you see the output file to be executed, it´s compiling all external files into one.

Does anyone know a way to overcome this o a beautiful workaround

I tried this option:

if '$(client)' = 'a' 
:r .\GeneralParams\s01.sql 
if '$(client)' = 'a' 
:r .\Clients\a\a01.sql 

GO

if '$(client)' = 'b'
:r .\GeneralParams\r01.sql
if '$(client)' = 'b'
:r .\Clients\b\b01.sql

but r01 has more that 1 GO and exits the if clause

Juan Piaggio
  • 190
  • 12

1 Answers1

0

the way I manage to implement this was doing individual if clauses inside each external file. It's not a pretty but it Worked. I've created an output clause to register all the crud changed made to the database.

Juan Piaggio
  • 190
  • 12