Visual Studio Database project: checking if SQL server login exists before creating it
问题 When I create a Visual Studio database project for SQL 2012 and synchronise it with an existing database (using Compare Schema), I also synchronise a SQL server login. Visual Studio generates the following script for the login: CREATE LOGIN [my_user] WITH PASSWORD = 'somesecurepass' When I try to publish the generated SQL on a server where this login exists, sqlcmd shows me an error: The server principal my_user already exists. When I look at the sql script generated by Visual Studio, I see