Monday, March 19, 2012

Cant see Db created inside VS 2005?

When I create a new Sql Sever 2005 express database inside of the VS 2005 Pro IDE I cant see the database from the Management Tool (Sql Srvr Express Management Studio). Is this normal? I can "attach" it and see it, but I wanted to make sure my environment was working correctly.

Thanks in advance for any input.

Tim

Hi there,

As far as I am aware, this is the correct behaviour. From memory, the databases you create via the IDE are basically local to the project you created them in.

However, as you have discovered, these are still standard .mdf and .ldf files and can be attached as to be visible as one of the database on your SQL Server Express instance.

Hope that helps a bit or sheds some light on things, but sorry if it doesn't
|||

To be clear, when you create a database in VS using Add | New Item | Database, it is an embedded project database as Nate suggests. This database uses a User Instance connection to manage auto-attaching the database to the application at runtime.

If you turn around and manually attach the database to the main instance of SQL Express, you application will fail when you run it as it will attempt to auto-attach the database to the User Instance, but the file will be locked so it won't be attachable within the application.

There are a number of discussions already in the forums and a white paper about User Instances if you want more info.

Regards,

Mike Wachal
SQL Express team

-
Mark the best posts as Answers!

No comments:

Post a Comment