Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2010 - Database Project with imported database fails to build

Tags:

I'm looking at the Database Project in VS2010, the idea being that I want something I can use to keep track of the database schema (in source control) and the ability to generate "new install" scripts, and change scripts.

When I create a new database project wizard and import my existing database schema, it won't "build". I get the error:

SQL03006: User: [scanner] has an unresolved reference to Login [scanner].

The SQL that generates this error:

CREATE USER [scanner] FOR LOGIN [scanner];

The user "scanner" is a login defined in the database I imported. I have no idea what it's teling me, and google isn't throwing much up. Any ideas?

like image 800
Matt Roberts Avatar asked Mar 29 '11 14:03

Matt Roberts


Video Answer


1 Answers

The Login is actually defined in the master database of the server install. The CREATE USER statement needs to point at an existing Login otherwise it errors. The Database Project is not aware of the Login at the server level. Either you can create a Server Project to handle the Logins, or you can turn off the checking of Security objects in your Database Project. See the answer by Demetri M for more details: http://social.msdn.microsoft.com/Forums/eu/vstsdb/thread/1f8226fe-b791-4344-8735-3d38307e8664

like image 74
Judah Sali Avatar answered Nov 23 '22 09:11

Judah Sali