Deploy Database with SqlPackage.exe or Microsoft.SqlServer.Dac.dll, any difference or benefits?

和自甴很熟 提交于 2019-12-24 10:09:01

问题


What is the difference between using Sqlpackage.exe and Microsoft.SqlServer.Dac.dll to deploy a database? Is there any benefits? We are just trying to deploy a database to localhost. Just curious if Sqlpackage exe has more options/functionalities than Microsoft.SqlServer.Dac.dll, or does it really matter at this point?

SQL Package:

SqlPackage.exe /Action:Publish 
   /SourceFile:"TestDatabase.dacpac"
   /TargetServerName:"localhost"
   /TargetDatabaseName:TestDatabase

Microsoft.SqlServer.Dac.dll

add-type -path "C:\Program Files (x86)\Microsoft SQL Server\140\DAC\bin\Microsoft.SqlServer.Dac.dll "
$dacService = new-object Microsoft.SqlServer.Dac.DacServices "Server=localhost;Integrated Security = True;"
$dp = [Microsoft.SqlServer.Dac.DacPackage]::Load("C:\DatabaseTest.dacpac")
$dacService.deploy($dp, "DatabaseTest", "True") 

来源:https://stackoverflow.com/questions/57444148/deploy-database-with-sqlpackage-exe-or-microsoft-sqlserver-dac-dll-any-differen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!