Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: What is the difference between create a db in server explorer to create in solution explorer Date: Thu, 24 Nov 2011 23:40:09 +0100 Organization: Erland Sommarskog Lines: 44 Message-ID: References: <4ece2d8c$0$281$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="nBFDv6s1VJQDuF1w6hpX2A"; logging-data="1127"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Co7m7wZCihiHWaniB8Nav" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:HfLAoreiXGuM3z4SGEuxIAy/nV8= Xref: x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:842 Tony (johansson.andersson@telia.com) writes: > I can create a database in solution explorer in the following way. > 1. Right click the project choose add new item > 2. Choose a SQL Server Database > 3 You get a question if you want to add the database to App_Data > > When you have done this the database will also appear in the Server > Explorer with extension mdf The created database does not exist within > the list of available databases in sql server Management Studio > > I can also create a database from server Explorer in the following. > 1.Right click on the Data Connection and choose Create new SQL server > Database > 2.A dialog (Create New SQL Server Database) appear. > 3. Choose what server for example the default server instance or perhaps > the named express instance > 4.Give the database a name. > 5 Now the database appear in the Server explorer with extension dbo > The created database also appear within the list of available databases in > sql server Management > > Now to my question what is the difference between these two ways to > create a database ? What are these Explorers you are talking about? That sounds like Visual Studio to me. I think VS creates a database and then detaches it, and leaves you with the file, and you are supposed to use the option AttachDBFilename. Now, why on Earth you would do this, I have absolutely no idea. But then generally Visual Studio leaves me in a maze. You may have to ask in a Visual Studio forum for a better answer. In *SQL Server* you can only create a new database in a single way: the CREATE DATABASE statement. And the tools always connect to SQL Server to run statements. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx