How to upload (import) with overwrite azure database using sqlpackage.exe
Asked Answered
T

1

6

It should be a simple thing to do, I want to upload/import my database with overwrite option, but I can't find it in the documentation

I have to delete it manually and upload with Import.

Tailored answered 10/8, 2014 at 15:39 Comment(0)
T
9

Ok I found the solution:

Generate backup:

C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe"
   /a:Export /ssn:"windowsusername\sqlexpress" /sdn:yourdbname /tf:yourdbname.bacpac

Drop existing database using sqlcmd:

sqlcmd -U [email protected]
   -P yourpassword -S azureservename.database.windows.net -Q "drop DATABASE yourdbname"

Import database:

C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe"
   /a:Import /SourceFile:yourdbname.bacpac
   /tsn:azureservename.database.windows.net,1433
   /tdn:yourdbname /tu:dbusernameonazure /tp:yopurpassword
Tailored answered 4/11, 2014 at 9:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.