Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have a dacpac that has set the BlockOnPossibleDataLoss set to false, however the deployment is blocked when I run it with sqlpackage.exe, telling me "The column [a] is being dropped, data loss could occur."

However when I use the exact same deployment profile and publish from Visual Studio 2012 it goes through.

share|improve this question
    
Have you tried executing sqlpackage.exe with /p:BlockOnPossibleDataLoss=false in the command line? (I have no idea if this actually works.) –  Max Vernon Nov 8 '13 at 19:30

2 Answers 2

Have you tried executing sqlpackage.exe with /p:BlockOnPossibleDataLoss=false in the command line?

I just used SQLPackage.exe to create a .dacpac file of my test database, then I pubished it with the /p:BlockOnPossibleDataLoss=false option, and it overwrote my database.

share|improve this answer
    
I tried that, however it didn't help. I did narrow down the problem a bit more. I execute the package within a powershell script and there it is within a try catch block. It seems that even though the flag is set sqlpackage.exe creates an exception (I would expect otherwise) –  nojetlag Nov 11 '13 at 9:07
up vote 0 down vote accepted

Finally found the issue, I execute sqlpackage.exe within a powershell script where the error handling is set like

$Script:ErrorActionPreference = "Inquire"

since i never got the Inquire I assumed the problem was with sqlpackage.exe, however I had another powershell script included after the ErrorActionPreference was set, turned out the included script also had the ErrorActionPreference set, but to "Stop". Still I believe if I have set BlockOnPossibleDataLoss=false it should not result in an error, but at least I now have a way to handle it.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.