sqlpackage vs sqlcmd
sqlpackage is a tool that allows us to deploy sqlproj/dacpac/bacpac files across different platform such as windows, linux. It uses a slightly different sqlproj format - removing some of the dependencies sqlproj has on msbuild.
Unfortunately it cannot be used for ispac / ssis packages.
I was abit confused when the docs mentioned SqlAzureDacpacDeployment - giving me the impression that sqlpackages is readily available as an azure devops task. Upon some googling - this tasks uses sqlcmd.
The differences between sqlpackage and sqlcmd are highlighted below:-
Key Differences
Feature | SqlPackage | sqlcmd |
---|---|---|
Primary Purpose | Database schema and data management (DACPAC/BACPAC). | SQL script execution and database interaction. |
Typical Use Cases | - Deploying database schemas. - Extracting or exporting schemas and data. - Publishing database updates. | - Running ad hoc T-SQL commands. - Automating scripts for database tasks. - Querying or modifying data directly. |
Input/Output | Works with DACPAC/BACPAC files. | Works with raw T-SQL scripts or queries. |
Automation | Best for CI/CD pipelines for schema deployments. | Best for running routine tasks or ad hoc queries. |
Cross-Platform | Yes. | Yes. |
Comments