SQL LocalDB Open in SQL Mgmt Studio Run Script - wpf

I created a new LocalDB database from Visual Studio in my WPF project. Now I'd like to run a SQL Script to create all the tables in it. But I can't find how I can open the database with SQL Management Studio? Is it supposed to work like an .sdf file where you can browse to open the database?
Thanks

You must install SQL Server 2012 Management Studio (Express) as described here: http://blogs.msdn.com/b/sqlexpress/archive/2011/10/27/net-framework-4-now-supports-localdb.aspx - download location: http://www.microsoft.com/download/en/details.aspx?id=29062

Related

Database is showing i visual studio but not in MSSQL server management

So i want to script my database, as you can see i have it in my visual studio project:
But in my MSSQL Server Management it's not showing all tabels
What should i do in this situation? How do i get it in my MSSQL Management so then i can script it?

SQL Server Manager not detecting local databases

I am trying to generate script for my sql local database created using visual studio 2010. When i open sql server manager and connect to localhost or SQLEXPRESS the database created does not seem to appear.
After you generated your .mdf with Visual Studio - did you attach it to your SQL Server instance??
In VS, you can setup stand-alone .mdf files which are not automatically visible inside SQL Server Management Studio. Those are typically referenced by your application using a connection string that contains
AttachDbFileName=(path)\Mydatabase.mdf;User Instance=true
If you have such an .mdf database - you need to first attach it to your SQL Server instance before you see it in SQL Server Management Studio.

Cannot open .sdf files in SQL Server Management Studio 2008 SP3

Has made a .sdf database file in Microsoft Visual Web Developer 2010. When I try to open it in SQL Server Management Studio 2008 Service Pack 3, it displays error message:
Cannot connect to C:\Users\Xtreme\Documents\Dishes.sdf.
Incompatible Database Version. If this was a compatible file, run
repair. For other cases refer to documentation. [ Db version =
4000000,Requested version = 3505053,File name =
\?\C:\Users\Xtreme\Documents\Dishes.sdf ] (SQL Server Compact ADO.NET
Data Provider)
What is wrong? There is no problem to work with the .sdf in Microsoft Visual Web Developer 2010.
You cannot use SSMS to open SQL CE 4.0 Database files.
You can use the Microsoft Web Platform Installer to load VS Tools for SQL CE 4 however.
source: http://social.msdn.microsoft.com/Forums/en/sqlce/thread/a9fca12d-6403-47ff-ab6b-fc1db42205c3
WebMatrix should be able to view/edit these database files as well.
Check out Erik EJ's web log - he has a ton of tools for handling all sorts of operations with .sdf files, and also an extensive list of third-party tools that work with SQL Server Compact Edition's .sdf files.
1.Open SQL Server Management Studio, or if it's running select File -> Connect Object Explorer...
2.In the Connect to Server dialog change Server type to SQL Server Compact Edition
From the Database file dropdown select
3. Open your SDF file.

SQL Server Questions

How do I rename a database in Server Explorer on Visual Studio 2008? I changed the filename using Rename on the context menu, but that just changed the filename, not the name in SQL Server (2005 Express).
Also, is there an easy-to-use management tool like PHP MyAdmin that I can use? Or is it easier to just use VS 2008 Server Explorer?
Thanks!
Find SQL Management Studio Express 2005 for all your common tasks in dealing with the database. You'll find it more fully-featured than Visual Studio, and provides the functionality you're used to from PhpMyAdmin.
To rename your database, create a new query, either in VS or SSMS:
EXEC sp_renamedb 'oldDB_Name', 'newDB_Name'

Importing a MDF file into SQL Server 2008?

I have inherited a VB.net web app that I'm making some changes on. I'm perfectly capable with the programming side (VB and MSSQL) but I'm getting lost with the tools. I was given a zip file of the code and everything. I opened the sln file in Visual Studio 2005 and it worked fairly easily with little modification.
Running the app works perfectly. Problem is, I need to write some new SPs so need the database admin. SQL Server 2008 Express is installed but it doesn't see any database and I have no idea how to import it.
I have a folder App_Data in the project with the file ASPNETDB.MDF. Opening this in VS gived the error:
This server version is not supported. You must have Microsoft SQL Server 2005 Beta 2 or later.
Any ideas where to go from here?
You need to get Sql Server Management Studio. From there you should be able to connect to the instance of Sql Server Express running on your system and tell it to attach to the .mdf file. This will allow you to use that database from withing sql server and management studio, and you will be able to add your stored procedure. Just remember to detach again when you're done, or you won't be able to use the mdf file as you expect from your app.
Visual Studio uses SMO 2005 to connec to to SQL. The SMO 2005 will not connect to SQL 2008 by design. You need to either upgrade VS to VS 2008, or downgrade Express to Express 2005.
You can't attach mdf file made in SQL Server 2005 to a SQL Server 2008 instance. What you need is to install SQL Server 2005 Express, attach this file, backup database, then restore it on 2008 Server instance and detach the database. You will get properly created for 2008 Server mdf.

Resources