SQLCMD / Dacpacs

Had a need to run a dacpac script that wasn’t part of pre or post deployments. You can use sqlcmd to do that for you by issuing the following:-

Sqlcmd –S <server>\<instance> -v <variablename>=<variablevalue> -i <sql script to run>.sql

So…

Sqlcmd –S localhost\myinstance -v databasename=mydatabase -i myscript.sql

Leave a Reply