Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL72043 and other SSDT errors: how can I find the incorrect code?

So, I've got a project in SSDT (SQL Server Data Tools) in Visual Studio 2012. When I build this project, there are no errors - it builds fine (not even a warning or a message).

However, if I try and publish I get:

The script file could not be found (no more information).

If I schema compare the project with an existing database, all I get is:

Cannot generate deployment plan (again, no more information).

Only when I do 'Run Code Analysis' do I get an error that could possibly mean anything:

SQL72043: 7 elements are in an error state

I know this error can be caused by a missing comma in a table definition or similar trivial errors, but I've been tearing my hair out for hours looking through every line of SQL code in the project to find a problem. Is there any way I can shed more light on what lines of my code are causing the error?

like image 726
Tom Bull Avatar asked Jan 31 '13 19:01

Tom Bull


People also ask

Where would you look for errors from the database engine?

All system and user-defined error messages in an instance of the Database Engine are contained in the sys. messages catalog view. You can use the RAISERROR statement to return user-defined errors to an application.

What information does @@ error hold in SQL?

If the error was one of the errors in the sys. messages catalog view, then @@ERROR contains the value from the sys. messages. message_id column for that error.

How do I run a repair option in SQL Server Data Tools?

Close the SSMS application (if it is running). On the computer, go to Control Panel > All Control Panel Items > Programs and Features. From the list of programs, right click SQL Server Management Studio and click Uninstall. Click Repair to begin the SSMS install repair.


1 Answers

Delete the dbmdl file in your database project.

like image 65
Lee Warner Avatar answered Jan 04 '23 13:01

Lee Warner