Missing Diagram folder in Database Explorer at Visual Studio 2012 - sql-server

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.

Related

SQL Server Compare Schema in Visual Studio 2017

I am attempting to compare schemas of two databases on the same server.
The two databases are named benchmarkdb and benchmarkdb_dev.
In Visual Studio 2017, I go to Tools > SQL Server > New Schema Compare...
From both drop down menus labeled "Select Source" and "Select Target" (as seen in the picture below), I want to select benchmarkdb as source and bencmarkdb_dev as target.
After clicking to select a source, the "Select Source Schema" pops up, and I clicked the "Select Connection..." button, which brought another popup. The newest popup (the one on the right in the picture below) shows both databases I am trying to compare.
However, after I choose one for either the source or the target, all pop ups close, but nothing populates the "Select Source..." or "Select Target..." drop down menus. In fact, it just goes back to looking like the first picture.
Is there a solution to this so I can compare the schemas between the databases?
Update:
I have tried this on VS 2012, 2015, and 2017. All are facing the same issue. VS software and system software are up to date. Below are some versions of software that I am using, if it is any help.
Windows 7 Enterprise SP1
VS 2012, 2015, and 2017
SQL Server 2014
.NET Framework v4.7.02053
OK, so I managed to fix it.
First off, you need to install SSDT from Microsoft pages. Just google it.
Make sure that you also have it listed in individual components when starting Installer (on Modify). Only SQL Server Database is required (I could choose from Integration Services and 3 more).
Next, you need to "Remove connection from history" in Schema Compare modal for connection selection.
I closed VS at this point, to make sure that the connection is not in history anymore.
Starting VS the next time, you should not have the problematic connection in history.
Recreate the connection (I checked "remember password") and voila. Schema compare works.
Not really sure, but in desperation I also installed "Redgate ReadyRoll Core", "Redgate SQL Prompt Core" and "Redgate SQL Search".
I don't think it matters, but if all else fails...
Edit: This worked on 2 machines and it doesn't seem to be connected to VS version.
I had the same issue, but I don't know if I had the same root cause.
My problems started after changing my database from SQL Server on a Window Server to SQL Server on a Linux Container. The schema compare would appear to accept my selection but the database field would never actually populate and I could not perform a comparison.
There were 2 things I had to do to solve the problem.
Update Visual Studio (using the standard updater within Visual Studio).
Update the SQL Server Development Tools (SSDT) add-on for Visual Studio to a preview version that supports SQL Server on Linux. That download is available here.
After both updates were in place I could select the database and execute Schema Comparisons between my project and SQL Server on Linux exactly as I had been doing for SQL Server on Windows.
If running a local database, check what version of SQL Management studio you are using
I had the same issue running Visual Studio Pro 2017 and SQL management studio v18.6 with SQL Server 2017 installed.
I tried all of the above solutions and no luck
Even going back to Visual Studio 2015 didn't work for me. What did work though was changing back to SQL Management Studio v17.9.1
No issues any more.
I may try to upgrade Visual Studio to 2017 again to see if that works now

Upgrading to Sql Server Express R2 Advanced Services in Middle of Development

I am currently developing, from the ground up, my first asp.net website. After implementing many of the more basic features for my site I have run into a problem with Visual Basic 2010's SQL Server 2008 Express. I want to have search with my site so users can look for specific records in my database, and from what I have researched Full-Text Search is the best way to go (right?). It wasn't until I tried to test my code that I realized the default Express edition doesn't have Full-Text Search enabled. My question is a.) how can I upgrade to the SQL Server Advanced Services in the middle of development without losing my Database's, and b.) what download should I use, because right now I'm thinking http://www.microsoft.com/en-US/download/details.aspx?Id=25174.
I really want to be sure that I am not only installing the right software, but that I won't completely screw up my project in the process. Along those lines, should I backup my database's and then uninstall my original version of SQL Server before downloading the Advanced Services version? I would really appreciate some help here because I have had massive headaches in the past trying to upgrade Microsoft software and just want a smooth transition.
Well it took me the entirety of a day, but I solved this! First I had to uninstall EVERYTHING regarding SQL Server. Then I downloaded http://www.microsoft.com/en-US/download/details.aspx?Id=25174 (X86 since I am on Vista) and used .\SQLEXPRESS as my Instance Name. Once it was done installing I had to delete the SQLEXPRESS folder in 'C:\Users[Your computer's name!]\AppData\Local\Microsoft\Microsoft SQL Server Data' to get my old connections to work! Then I could create databases in SQL Server Management Studio that had Full Text enabled.

How to debug SQL Server T-SQL in Visual Studio 2012

How does one debug a T-SQL stored procedure in a multi-tier application in Visual Studio 2012?
To be clear, I want to set a breakpoint in a sproc in VS 2012, and hit it when the sproc is called from an ASP.NET WebForms app in the same debugging session.
When following the same steps as for VS 2010, the breakpoints aren't hit inside the sproc.
Debugging T-SQL in a sproc on a SQL Server 2008 R2 Express database works as expected in Visual Studio 2010.
To be sure everything was enabled properly, I went over the instructions for VS 2010 (here), but no such page exists for VS 2012 or .NET 4.5.
It seems the missing step is to enable "Application Debugging", but no such option exists in the Server Explorer > Data Connections context menu in VS 2012.
VS 2010 Application Debugging
VS 2012 No Application Debugging
You need to open "SQL Server Object Explorer. Not "Server Explorer". That is what is different between 2010 & 2012. Then right click on the server and select "Application Debugging".
This is for VS2012 and SQL2012. Yes things are somewhat different for other versions, but kinda follow similar setup. It is tricky because one has to have various settings just right or it won't work.
vanilla install of both VS and SQL with all correct options (how to do this is outside scope of this article)
full admin rights to entire environment and sysadmin rights to sql (fundamentally a development environment; you would not want to do this in a production environment)
i always debug .net web apps under full local IIS which is a windows feature installed from control panel
go .net project properties, web, use local iis web server (i also stick to default port 80)
while i develop my databases etc using VS sql server database project, i always work under full standalone local SQL; i use the schema compare to refresh that sql with changes made in VS (how to do this is outside scope of this article)
do not place your breakpoint on that copy of the sp; that version of the sp is only a blueprint and not the runtime version
go .net project properties, web, debuggers (at bottom) enabled for .net and sql server
view sql server object explorer (not server explorer)
click add sql server, add your full local sql server using sysadmin credentials (i always use sa for such work)
right click on your full local sql server and enable application debugging
there go find the sp and right click and view code, then add your breakpoint there; this is runtime version of sp (note that i never make changes to sp there, i go do these in my master copy under the database project)
rebuild solution, and execute .net web app in debug mode from within ide by clicking green arrow internet explorer
I hope I have not forgotten anything. If I have I'll come revised my post.
All this may sound complicated. It is. But with a little discipline and patience it is priceless.
Good luck.
I believe the easiest way to do this would be to add DB as a project to your solution. You can do this by right clicking on the DB in the SQL Server Object Explorer (SSOX). This is a really good way to develop and debug your DB's. After you have added the DB to your project, you can add breakpoints anywhere you want, and debug against LocalDB (or another target if you wish). The largest drawback to this approach is that your existing data will not migrate with you (although you will be able to easily publish any changes back to the SQL DB at will). See the documentation on SSDT on MSDN for further guidance.
The following in detail article explains exactly how to enable debugging of a Stored Procedure when a .Net application is executed.
http://www.sqlmag.com/content1/topic/debugging-stored-procedures-142054/catpath/sql-server

How to get Enterprise Manager installed in SQL Server 2008 Express?

I've installed Microsoft SQL Server 2008 Express twice now, and all the services work and I can create databases from Visual Studio 2010, but I don't have the Enterprise Manager (I learned it is now called Management Studio) available in the SQL Server 2008 program menu-- I do have other menu items like configuration manager, etc. but nothing for Management Studio / Enterprise Manager.
Is there a checkbox I've missed during installation?
I ran a search for all exes in the SQL Server root folder and nothing jumped out as belonging to the Enterprise Manager, but I'm not 100% sure what the executable would be named.
Primary question:
What is the procedure required to install the Management Studio client [for/with SQL 2008 Express] ?
Secondary question:
What is the name of this client's executable file ?
SQL Server Express doesn't come with SQL Server Management Studio (what you are really looking for when you say Enterprise Manager). You have to download it separately:
http://www.microsoft.com/download/en/details.aspx?id=7593
or with tools already as part of the download
http://www.microsoft.com/en-us/download/details.aspx?id=22973
It's kind of tricky installing Management Studio. This article walks you through it.
Here is an explanation of the situation:
The 2008 version of the Management Studio is not a stand alone installation and can only be installed as part of the SQL Server 2008 Express with Tools or Advanced installation.
Like many others, I spent countless hours trying to figure out how to
install the Management Studio for SQL Server 2008 Express - Advanced
installation (same should apply to the w/ Tools version). What
happened in my case was that I installed Visual Studio 2008 Express
and during that process a stripped down "Instance" of SQL Server 2008
was installed that did not include the Management Studio. Through
much pain and torture I learned that the Management Studio can only be
installed during installation of the first instance. To delete that
first instance, you must go to "Add or Remove Programs" and remove
"Microsoft SQL Server 2008". The removal process will only remove one
instance at a time and if you have installed more than one instance
you need to keep going until all instances have been removed and the
application completely disappears from the Add or Remove Programs"
dialog. Note: You do not need to uninstall any of the other SQL
Server 2008 applications that also appear in the "Add or Remove
Programs" dialog. Then go back through the install process as
follows: Double click on SQLEXPRADV_x86_ENU.exe to load the SQL Server
Installation Center and then go to Installation > New SQL Server
stand-alone installation. Then proceed through all of the
installation steps until you get to “Feature Selection” and click on
“Select All” to toggle on all of the Shared Features, which should
include Management Tools - Basic.Continue the process from there and
you should be good to go. Hopefully this will help others to avoid
much of the pain that many of us have already experienced.
The Management Studio exe is named ssms.exe.
The OP is not alone in his puzzlement about the "missing" management client!!! ;-)
The answers by DOK and CD Jorgensen found here were -collectively- among the most helpful I found while searching the web on this particular issue! At the risk of being redundant, I'm adding this answer with the goal of being more explicit and of safeguarding the key screenshots from Andrea Montanari's article referenced in DOK's answer.
Two things to know:
Not all installation packages for SQL Server 2008 Express Edition include the Management Studio.
You either need to ...
a) ... download the Install package for SQL Server 2008 Express with Tools (named something like SQLEXPRWT_cpu_language.exe: note the WT, short for With Tools) or an installer for an Edition of SQL Server other than Express.
or
b) ...download the Installer specific to Microsoft SQL Management Studio Express (same link as provided by CD Jorgensen). This installer only contains the Management Studio; it has none of the SQL Server per se.
[if you go with an a) install package]
The Management Studio (formerly Enterprise Manager) client remains a stand-alone, independent, component. However its installation is now triggered from a selection made as part of the "Install or Modify SQL Server" track.
It is not found in a separate "Install clients and Tools" menu item from the topmost dialog of the installer (as was the case with SQL 2005 and previous versions).
One should stress that it is stand-alone and the client can indeed be installed on hosts where the SQL Server [engine] is not, and will not be, installed at all. However the initial steps in the Installation Wizard give a strong impression that we will effectively install or re-install SQL Server. It is only on a subsequent step labelled Feature Selection that we have the ability to select Management Tools under Shared Features. On that same Feature Selection dialog we have the option of including or excluding, as desired, the installation of the SQL Server Engine and other Server supporting modules.
These are the two key dialogs of the wizard with regards to this issue:
The first one really appears to put you on track to install or mess with the SQL Server itself, the other dialog finally provides the opportunity of opting for the Client Tools (which include, mainly, the Management Studio). This same dialog also allows checking or un-checking the selection to install the Server per se.
Credits and more info:
The screenshots were taken from Andrea Montanari's article on the Insulin Power web site. This article referenced in DOK's answer provides a step-by-step description of the installation based on the "With Tools" installer.
As said in the introduction, I learned much from CD Jorgensen and DOK's answers; I'm merely making a few things more explicit, here, and correcting a few omissions (e.g. there are some installers which carry both the Server and the client, and it is not necessary to install the server).

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

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.

Resources