How to get Script.PostDeployment.sql to execute external sql files conditionally using SQLCMD syntax

How can Script.PostDeployment.sql be coded to conditionally execute external sql files?

I know the following doesn’t work, but it’s what I’m trying to do:

if not exists (select name from SomeTable)
:r .InsertStaticData.sql


Hi wallyh010If you want to include SQLCMD commands and Transact-SQL commands in the same script, you must ensure that the script  conforms to the following requirements:SQLCMD commands must be the first statement on a line.Only one SQLCMD command is permitted on each line.SQLCMD commands can be preceded by comments or white space.Single line comment characters are two hyphens (–) and must appear at the beginning of a line. Comment characters prevent SQLCMD commands from being executed.Before each SQLCMD command, you must place a colon at the start of a line to clearly distinguish it from Transact-SQL commands. The only exceptions are the

Thanks for your post; however, I have read the documentation and do not understand why my approach does not work.The following example does not work  either.:setvar CreateNewDatabase TRUE

Hi wally,You post-deployment code is fine. But from the error code, it indicated that the syntax/format in the file InsertStaticData.sql is incorrect.