SQL Database Tools in Visual Studio 2012 - sql-server

I'm trying to setup my Visual Studio Project to be able to use only one IDE for managing SQL objects using TFS 2012. Is there any way to configure my project connected to a source control and if for example I go to SSMS and try to modify a stored procedure, automatically takes the one in the source control or vice versa using Visual Studio 2012 check out a procedure and from SSMS shows me that is checked out?
No matter where I'm (Management Studio or Visual Studio 2012)the SQL objects are synchronized.
Thanks

Microsoft doesn't provide any built-in support but you can link your SSDT database project to SSMS using the latest version of SQL Source Control, which is a commercial tool developed by Red Gate, the company I work for. Steps are:
Download SQL Source Control and install it (it has a 28-day free trial)
Load SSMS, right click on your database in the object explorer and select the Link to Source Control option.
In the Link dialog, browse to the database project folder in your repository.
That's it. It's now set up. Simply use the Commit and Get Latest tabs to keep your database in sync with your database project in source control.
I'd be happy to assist should you hit any problems. Please add a comment to this answer or contact support#red-gate.com

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

How can I integrate SQL Server with MSSCCI provider for tfs 2013&2015?

I was trying to use Team Foundation Server 2012 with Sql Server Management Studio 2012. I installed the Microsoft Visual Studio Team Foundation Server 2013 & 2015 MSSCCI Provider 32-bit and choose it as Current source control plug-in under tools -> Source Control -> Plug-in Selection of SSMS.
The problem is when I create/open a solution, for the very first time, and try to add a solution to source control from file -> source control -> Add Solution to Source Control a dialog box appears asking to connect to tfs once connected and location of server is specified on server and ok button is pressed it shows a warning that my workspace is a local workspace and local workspaces do not work properly in MSSCCI. It asks if I want to change it to server workspace once I click on Yes
I get the following error
Unexpected error encountered. It is recommended that you restart the application as soon as possible.
Error: No such interface supported
File: Vsee\internal\inc\vscomptr.inl
Line number: 259
Trying again yield this error message as soon as I choose Add Solution to Source Control.
I have tried some of the hotfixes provided by Microsoft from the link :
https://support.microsoft.com/en-us/kb/2727824 but they do not install on my machine saying that my SSMS version is newer.
How can I get this problem resolved ?
As described in this article - Team Foundation Server 2012 brought up a change in the workspace options bringing a new type of workspace – a local workspace. A local workspace is an improvement in offline work and it allows performing a number of source control operations without the connection to Team Foundation Server.
For more information about server workspaces vs. local workspaces refer to the following article: http://blogs.msdn.com/b/phkelley/archive/2013/05/29/server-workspaces-vs-local-workspaces.aspx
The article states that Microsoft continues to fully support the older kind of workspaces (from VS/TFS 2005 - 2010), but they now call these “server” workspaces. In the VS/TFS 2005 - 2010 documentation there is no mention of these workspaces ever being called “server workspaces” – because before the existence of local workspaces, there was no need to have a special name for them - they were just “workspaces.”
Hope I helped.
I am using TFS Online (Visual Studio Online), SQL Server Management Studio 2012, Windows Server 2008 R2, and installed Microsoft Visual Studio Team Foundation Server 2013&2015 MSSCCI Provider 32 bit. I can add new solution in SSMS and add to source control with no issue. You might want to
1. go back and create the server workspace FIRST in Team Explorer 2012.
2. Then re-create the solution (Make sure you check the Add to Source Control),
3. then select the TFS with the correct server workspace.
4. from Solution Explorer, right click on the project and add existing items.
Hope it helps

Not able to see script (VB code) from SSIS script task

I have one already developed SSIS application using SQL Server 2005. I'm trying to view the script like below:
Right click -> Edit -> Script -> Design script
[normally instade of "Design script" it should come "Edit script". I think, due to SSIS 2005 its like that]
However, its not showing me underline script.Its not showing any error as well.
I have BI studio 2005 installed. However, I can not see VB under(file -> new -> project) if I'm going to create new project. So, do I need a Visual studio version 2005 with VB to be installed to open this?
Is there any other way to see this? OR is there any settings needs to be changed to see this underline script?
Hum I don't know what is causing that error but Visual Studio BI edition is enough (and required) to edit all functionality of a SSIS. Including the VB code in the Script Task without the need to install the whole VB environment.
You should really watch about any error reported when you open the solution, especially the "corruption" messages which are usually indicators that Visual Studio cannot decipher the parts of the SSIS that were encrypted (depending of the security model of your SSIS).
You also would want to make sure you've installed the Visual Studio BI for 2005 and not 2008 (or other) since, unlike 'classic' projects, SSIS projects are highly tied with the version of VS BI it was created with.

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

visual studio 2010 database project, is there a visual way?

started a visual studio 2010 database project. however i am only able to write sql in a text mode, there is no functionality in making the table for example in a visual view as exists when you add a new database to app_data folder and the work on it there.
is this the only way and there is no visual way of doing this in the visual studio 2010 database project? or am i missing some obvious way of getting to it?
http://img693.imageshack.us/img693/9311/42342496.png
thank you
also if there is a tutorial anywhere (video maybe!?) please link it. i only found importing a database from an existing script video using a wizard. would like new database from scratch without wizard.
There is a simple workaround you can use to have visual design capabilities. You need a dev database set up anywhere. Now create a schema synchronization with Visual Studios built-in Schema Comparison. This will allow you to pull changes between your dev database and your database project back and forth.
Since you can sync in both directions, you can make changes to your database via database diagrams from inside VS (via the Server Explorer) or you can use SQL Server Management Studio (or whatever else you like). When you're done, simply sync your changes using the schema comparison. It works in the opposite direction too, simply change one of your scripts and then sync with your dev database.

Resources