Best way to browse an mdf file from a local computer? - sql-server

I'm working on an ASP.NET MVC site which will have a database. While I'm in this very early testing/concept phase I'm not hosting the database anywhere, just inside the local mdf file. What are some tools I can use to connect to the local test server so I can browse the tables and run test queries against the information in them without having to implement my own code/views? I'm interested in something like Sequel Pro for the Mac or phpmyadmin for linux (OS doesn't really matter since I'm working on a Mac developing inside a win 7 virtual machine).
Thanks!
(NOTE: I realize it is possible to get the table info dumped via Visual Studio, but it seems slow and not too useful... unless I'm missing a good way to use VS2010 the way I'd use one of the tools mentioned above?)

You can use SQL Server Management Studio Express to browse it, and do several other useful things as well, including table design and the like.

Consider using the built in tools right within Visual Studio. You'll need SQL Express installed, but you won't necessarily need Management Studio.
Go back to the Visual Studio installer (Repair or resintall features), and ensure that's selected as a feature.
Open Server Explorer, and create a new Data Connection.
Choose Microsoft SQL Server Database File
find your .mdf
Server Explorer then gives you a drill down of your Tables, Views, Stored Procedures, etc.

Related

Can I use a SQL Server project to create/manage a LocalDB file?

I'm new to SQLServer and related Visual Studio tools though I know SQL well.
I want to have a local test DB on my dev PC with some stored procedures (so it needs to be SQL Server not SQLLite). LocalDB seems the answer and I can create a LocalDB MDF file through Server Explorer. But I don't think I can/should be putting an MDF file in version control - other developers need to have this DB for their local testing too.
I feel like the Visual Studio SQL Server Project type is what I'm after here but I don't see how such a project is linked to an actual DB. In my mind I imagine setting up a SQLServer project in VS, adding tables/stored procs/etc, and this will automatically build a LocalDB MDF file.
I'm unsure how thee things hang together and where the files all go, can someone help clarify this?
I'm basically starting from the point: I have a SLN with my C# projects in. My C# code calls certain stored procedures using a connections string from configuration but no DB actually exists in the wild yet. Any developer ideally needs a dummy DB to be created when they build the code, not have to create it manually, without installing SQLServer.
So it seems like I want to create a SQLServer Project in my solution, which will magically create a LocalDB. Is that feasible/correct?
Do you need to use Visual Studio at all, would SSMS not meet the requirements if you only want to execute some stored procedures? SQL Server Express is free, it's just limited on size, I believe that the SQL developers edition is free as of pretty recently, may be worth looking into.
I've got a couple of installations of SQL Server on Hyper-V Virtual machines too for testing purposes, this could be an option.

Can Visual Studio replace MS Sql Server Manager?

I've been using Dreamweaver and MS SQL Server Management tool. I've recently got Visual Studio 12. I would like to only use Visual Studio.
When I right click on a table in the db I don't get the Script Table As options.
No, and it's not intended to. SSMS has a lot of functionality which Visual Studio's Server Explorer doesn't, and shouldn't, attempt to reproduce.
For certain use cases, you may only need the functionality exposed within Visual Studio. But I wouldn't want to be without SSMS and all of the tools it includes. Trying to limit your usage to only VS sounds like cutting off your nose to spite your face.
If you want to have a complete administration of your database I would recommend you to use MS SQL Server Management tool, because you can to do tasks like:
Administrator privileges
Security
Maintenance plans
(Only mentioning a couple of tasks. There are more.)
If you want to create a fast DB with the basic tasks with VStudio will be enough.
I will write a couple of links that you can visit, I hope this can help you more:
SQL Server- video tutorials
MsSQL - Tutorials

SQL Server management in VS2012

At university we have a server lab in which we do development using VS2012 for web modules such as ASP.NET. For such modules, we use Microsoft's SQL server.
My question is which extension in VS2012 would enable you to right click inside an 'open' table giving you options such as Check Constraints, Relationships etc.
I ask this because I have downloaded VS2012 to work on my own personal projects, but on opening a table and right clicking it, I receive an entirely different set of options, and I don't really want to write the SQL myself.
Any help would be very much appreciated. I have installed Sql Server 2012 with management tools etc on my machine here but not really sure what that's meant to achieve or how to integrate it into VS.

Missing Diagram folder in Database Explorer at Visual Studio 2012

I was in a middle of designing a website when suddenly Database Diagram folder just disappeared from the Database Explorer. I have no idea what happened and what to do right now, as I desperately need it to continue my work - adding tables to database manually are not an option for me.
I've been seeking for the solution for a whole day, and I even re-installed the Visual Studio and local IIS server, but it wasn't helpfull at all.
Is there any way to bring the feature back or at least is there any free tool that would work on Windows 8 x64 and has diagram-based database designer for MSSQL 2008?
EDIT
It seems that Microsoft removed the diagramming for purpose. Which is pretty logical in a business logic - why would somebody buy Server Management Studio if they have basic tool (diagramming) built in Visual Studio?
1) Database Diagram is a feature of SQL Server, not Visual Studio. I am not sure what VS uses to display that folder but you might want to verify with your DBA or check the configuration of the database to see if someone has not just disabled the ability to use diagrams. Have you tried refreshing your connection to the database server as well?
2) How is adding tables to a database manually not an option? If you get yourself dependent on doing things one way and only that one way you are setting yourself up for disaster in future projects, as you are in your current one. There are other ways from within VS to create a table, it just may not be a graphical picture that diagrams offers.
3) Have you looked at the database through SSMS to see if the diagrams folder shows up there?
Hello this has been my solution that worked for me and enabled me to use database diagram ide in visual studio 2012!!
First i installed SQL Server Management Studio. I then noticed that i still did not have SQLEXPRESS Service or SQL Agent Browser in my computer services either.. This was why i assume i couldn't login to any of the SSMS which was annoying. I then downloaded SQL Server Express R2 which then ran me though another setup which was fine. I did also choose to put a sql server password for SQL Server Express.
Once installed I double checked to make sure the services where running by right clicking MY COMPUTER / MANAGE / SERVICES -- scroll down till you see "SQL Server (SQLEXPRESS)" and make sure that the service has started and also "SQL Server Agent (SQLEXPRESS)" (this one was turned off when i checked) .. i was then able to login to SSMS without a problem.
I then created a new database, right clicked diagram like we always do in VS and created a diagram with two tables, created their relationships blah blah..
i then created a new website in vs 2012, i clicked "Connect To Database" in the SERVER EXPLORER"
I choose my server name, used windows authenication and selected the database i just created in SSMS.
Then to my suprise i now have database diagram designing in Visual Studio 2012.. Finally!
Thankyou microsoft for removing such a cool feature which now gives us developers a few things to do.
Hope this helps.

Is is possible to write MS SQL Server add-in?

Is is possible to write MS SQL Server add-in? I'm thinking of some application integrated with database server available form SQL Server Enterprise Manager.
Have you looked into using extended stored procedures to provide add-in like functionality?
The only hang up would be to see it in the Enterprise Manager, but you can probably use Martin's post as a way to do that.
http://support.microsoft.com/kb/190987
You might consider researching extended stored procedures. They are a way to integrated C++ logic into SQLServer. It appears that they are being phased out in favor of CLR integration but there might be some really good ideas to be found is seeing what people have done with them.
The one thing that always scared me off of extended stored procedures is that if your code crashed the entire database goes down. They run in the SQL Server process and there is limited protection.
MSDN link:
Database Engine Extended Stored Procedure Programming
I'm not sure if this is too late but here are some links that I've used to get started in writing SSMS plug-ins.
http://jcooney.net/archive/2007/11/26/55358.aspx
http://www.karpach.com/ViewArticle.aspx?ArticleFileName=SQL-Server-Managment-Studio-Object-Explorer-Search-Add-In.htm
http://sqlblogcasts.com/blogs/jonsayce/archive/2008/01/15/building-a-sql-server-management-studio-addin.aspx
http://aspalliance.com/1374_Extend_Functionality_in_SQL_Server_2005_Management_Studio_with_Addins.all
I hope this helps
You can include a lot into MS SQL server 2005 and 2008 database. Including .Net code.
But there is no real way to extend (create plugin for) the Management Studio. (Formerly Enterprise Manager.)
However there are database management addins for Visual Studio (especially in Team System). Maybe there you can implement what you need.
Nothing directly that I know of. In SQL Server Management Studio (for 2005 and later) at least there's a pretty simple system for adding external tools to the menu. Enterprise Manager probably has something similar. So you could build an application that does whatever you want and add it to your menu.
The trick is deployment. There's almost certainly a way to add your app to the menu as part of an install package, but I haven't had to mess with it myself. Additionally, it sounds like what you really want to do is have the system deployed into the database itsefl, and have Enterprise Manager automatically detect it. I'm pretty sure you can't do that.
SQL Server Enterprise Manager is just an instance of Microsoft Management Console. If you look at the shorcut its command line is this:
C:\WINDOWS\system32\mmc.exe /32 "C:\WINDOWS\system32\SQLServerManager.msc"
You should be able to create a new Snap In that sits beside SQL Server in the tree hierachy.
Take a look at http://msdn.microsoft.com/en-us/library/ms692755(VS.85).aspx to see how this is done.

Resources