SQL Server management in VS2012 - sql-server

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.

Related

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.

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.

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

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.

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