Invoke-DlmDatabaseSchemaValidation: how to debug Incorrect Syntax errors?

I'm trying to use the schema validation from the command line but for some reason it's spitting out a bunch of errors. Unfortunately nothing useful is there to give me any context about where this is coming from:

Incorrect syntax near '-'.<br>Incorrect syntax near '-'.<br>Incorrect syntax near '-'.<br>Incorrect syntax near '-'.<br>Incorrect syntax near '-'.<br>Incorrect syntax near '-'.<br>Incorrect syntax near '-'.<br>Incorrect syntax near '-'.<br>Incorrect syntax near '-'
Where? What's it trying to do? Where is the script it's trying to run? Where is the log file? I'm running -verbose and -debug and it's still not telling me anything I can use to figure out what to fix.

Any suggestions?

Tagged:

Best Answer

  • Sergio RSergio R Posts: 610 Rose Gold 5
    Answer ✓
    Hi,

    To troubleshoot Invoke-DlmDatabaseSchemaValidation errors I recommend using SQL Compare, and do a comparison between your scripts folder and an empty database.

    You can then generate a deployment script which will hopefully provide you more insight on the error.
    Sergio
    Product Support Engineer
    Redgate Software Ltd
    Please see our Help Center for detailed guides on how to use our tools

Answers

  • turbopockyturbopocky Posts: 5 New member
    Thanks for the suggestion, I just wanted to follow up with the answer. I was able to use standalone SQL Compare without any issue, but now I also tried standalone SQL Data Compare just to see what would happen and sure enough the same error showed up. I didn't guess that Invoke-DlmDatabaseSchemaValidation would also attempt to push our static data, but that's what it was doing. It turns out we have a trigger that breaks if the database name has a hyphen in it. That's easy enough to avoid. Getting ahold of the failed script and isolating it in SSMS was what allowed me to find the problem.
Sign In or Register to comment.