locked
Deploy Failed? - Database Project RRS feed

  • Question

  • We have a fairly large database and I have been trying to set up a database project so that we can begin to manage our changes properly as a team. I seem to have everything working except everytime I right click->deploy in the bottom right is always say Deploy Failed. Nothing else... No reason why or what I can do to fix it. 
    Now the confusing part is, the deploy does not actually fail! The database gets created and all the tables and schema are in tact. 

    There is a problem however. I made a change to one of my tables, to add a dummy column with NOT NULL specified. Because there were already records in the table obviously an addition like this would not be allowed. I tried it anyway(project built with no errors), when I deploy I get my "Deploy failed." error but this time when I go to the database the column is not added!

    So if every time I deploy this database, I always get a deploy failed message whether it actually failed or not, this database project is beginning to look like it is not a viable solution.

    Here are the messages I get if I simply take the generated script file and try and run it against the database:
    Msg 102, Level 15, State 1, Line 1
    Incorrect syntax near ':'.
    Msg 102, Level 15, State 1, Line 2
    Incorrect syntax near ':'.
    Msg 102, Level 15, State 1, Line 3
    Incorrect syntax near ':'.
    Msg 50000, Level 16, State 127, Line 5
    The database name in the build script $(DatabaseName) does not match the name of the target database SQSData_Dev. Verify whether your database project settings are correct and  whether your build script is up to date.
    Msg 50000, Level 16, State 127, Line 9
    The database compatibility level of the build script 90 does not match the compatibility level of the target database (null). Verify whether your database project settings are correct and whether your build script is up to date.
    Msg 102, Level 15, State 1, Line 2
    Incorrect syntax near ':'.
    Msg 911, Level 16, State 1, Line 2
    Could not locate entry in sysdatabases for database '$(DatabaseName)'. No entry found with that name. Make sure that the name is entered correctly.
    Msg 102, Level 15, State 1, Line 2
    Incorrect syntax near ':'.
    Dropping foreign keys from [dbo].[Holiday]
    Dropping foreign keys from [dbo].[mapBranch2Calendar]
    Dropping constraints from [dbo].[Calendar]
    Rebuilding [dbo].[Calendar]
    Msg 515, Level 16, State 2, Line 9
    Cannot insert the value NULL into column 'Rawr', table 'SQSData_Dev.dbo.tmp_ms_xx_Calendar'; column does not allow nulls. INSERT fails.
    Creating primary key [PK_Calendar] on [dbo].[Calendar]
    Adding foreign keys to [dbo].[Holiday]
    Adding foreign keys to [dbo].[mapBranch2Calendar]
    Msg 911, Level 16, State 1, Line 9
    Could not locate entry in sysdatabases for database '$(DatabaseName)'. No entry found with that name. Make sure that the name is entered correctly.


    Please let me know if I am doing something wrong.

    The server the schema was copied from is a server running SQL 2005 and it is being deployed to my local machine running SQL Express 2005. I am also running Visual Studio Team System 2008.
    Thursday, October 22, 2009 4:58 PM

Answers

  • Can you post the text in the output window when it says deploy failed?  The generated Sql has SqlCmdVariable syntax in it, if you want to run that script in another tool like SSMS, you need to turn the SqlCmdVariable mode on, and define the necessary variables like $(DatabaseName).  There is a button in the View menu of SSMS called SqlCmd Mode.
    Thursday, October 22, 2009 6:11 PM
    Moderator

All replies

  • Can you post the text in the output window when it says deploy failed?  The generated Sql has SqlCmdVariable syntax in it, if you want to run that script in another tool like SSMS, you need to turn the SqlCmdVariable mode on, and define the necessary variables like $(DatabaseName).  There is a button in the View menu of SSMS called SqlCmd Mode.
    Thursday, October 22, 2009 6:11 PM
    Moderator
  • I found the SQLCMD Mode on the the query menu.
    Thursday, September 23, 2010 3:34 PM