I have a large repository of SQL scripts in SQLCMD syntax. Each script has 0 or more $(SomeParam) defined. We have a utility which executes the scripts and passes in the values for the $(params), essentially enable us to configure and automate builds for a wide range of data models.
Sometimes our build process fails because a script has a $(param) specified which is not configured in our utility. i.e. we have no value for this $(param) set
I would like to perform a test-run of these scripts prior to executing them. The test run should ensure that all required $(params) have been supplied to the script. The SQL itself should not be executed - I just want to know if it is compile-able. Is this possible to achieve using sqlcmd?
Alternatives Considered
I've considered one alternative of using a Powershell script to find matches for all $(param) in the file (using RegEx) and cross-checking that against our list of params in the utility. I'd prefer to retain all functionality either on the sqlcmd command-line or in the SQL scripts themselves if possible.
SET NOEXEC ON.