SQL Stored Procedure Debugging in VS2010 - visual-studio-2010

I am attempting to debug a stored procedure in VS2010 using the Server Explorer and the "Step into stored procedure" menu item command.
The issue I am having is that when I right click on the stored procedure, the only options I have are Copy, Refresh and Properties. Is there anything I need to do to make the "Step into stored procedure" option appear?
SQL Debugging is enabled in the project properties for good measure.
The Step into option is available in my vs2005 installation.

You have to add the server / database to Visual Studio 2010 Server Explorer.
Then you'll be able to debug stored procedures.

This should work using VS10 Pro and MsSQL10R2, and have set up the MsSQL instance where the stored procedure lives in Server Explorer so that VS10 can connect to the same server instance your program connects to to execute its SP. Opening the Server Explorer and locating the SP, then right-clicking its name in the tree-view gives you this option.
Previous MsSQL versions supported SP debugging only in tools like Query Analyser, and then by standalone execution rather than as part of a running mixed-platform application program.
In VS10 one can also debug stored procedures on MsSQL9 this way, by standalone execution, by opening a SQL window, right-clicking and picking "Connection" from the pop-up window, and connecting to the server instance on which you wish to execute the query or SP. In the PL/SQL script representing the guts of the SP one can then set breakpoints.
(Note that this started out as a WAG: I've done it before and happend across this question while surfing for information to elicit enough recall that I didn't have to re-enact the entirety of the original train of thought. Then I revised the answer as I went along checking that what I thought worked worked.)

Have you tried to script out the stored procedure and open the sql file into your local or server SQL Server with Management Sudio? You will be able to set some PRINT flags and debug as per your needs. Hope this workaround works!.

check that you use data provider: ".Net Framevork DataProvider for SQL Server"

Related

Oracle Developer Tools (ODT) & Visual Studio Integration

I've installed the ODT for Visual Studio 2015 (I've also tried VS2013) in hopes of using the "Oracle Database Project" but experiencing some specific error messages that don't appear to be very common.
When I browse the database via the Server Explorer, there is an option for you to be able to right click on a Relational Table and click "Generate Create Script to Project...".
However, when clicking this option I get a very non-specific error message and cannot work out why;
"Create script was not generated to Project for some of the selected object(s). See the 'Oracle Database Output' output pane for more information."
When I look at the "Oracle Database Output" window I get the message;
"Script Generation failed - Internal Error."
For here-on-in, it's gets very frustrating to find out what's wrong and to debug this non-descriptive error message.
What's most interesting is that the script generation function works for other database objects such as views & procedures, it just fails to work for database tables.
Has anybody experienced this error before? I'm wondering if it's a driver issue of some sort! (I have the oracle 11g client installed, and just tried with a specific ODAC/ODT combination package which appears to also install the 12c client, connecting to an Oracle Elements 11g server)
Any help appreciated, Thanks.
I have this problem too.
I was able to Create the scripts earlier, but now I cannot.
I did some investigating and decided this is not a problem with the oracle database. It is something to do with the state of VS.
I restarted VS2015 and I could create scripts again.

Sql Server 2008 Database Project Delta Deployment

I have created a new Sql 2008 Database Project in Visual Studio 2010. I imported the database objects and only kept the stored procedures. That all worked as expected. Where I have the problem is that it tries to deploy the entire set of procedures each time. I expect it to only create the deployment script for the delta. I am pretty sure that I combed every setting, but I can't find it. So if someone could first validate that this is possible and second tell me where to look. I need to do this because we only deploy the stored procedures with each release, the database schema is not modified.
Do a Schema compare of the project (as source) with the database where you want to deploy (as target). Once shcem comparison results are shown you have a choice to select which changes you want to deploy and then click the button "Export to T-SQL Editor". It will create the delta script.

How to re-deploy, re-create database on each test run

Currently I'm using Visual Studio 2012 RC and SQL Server 2012 RTM.
I'd like to know how to re-deploy/re-create a test database for each test run.
Keep in mind I've a SQL Server database project for the database using Visual Studio 2012's template.
Actually I'm not very sure about an idea I got in my mind, but .testsettings file has Setup and cleanup scripts. Is this the way to go? For example, a PowerShell script reading the database project generated script and executing it against the database?
I guess there're better ways of doing that and it should be an out-of-the-box solution but I ignore it and Google doesn't help me in finding the right solution.
As mentioned you'll probably want to use the VS 2012 .Local.testsettings > Setup and Cleanup scripts to create / tear down you SQL Server database.
For the script you may want to use powershell with a .dacpac (rather than just a T-SQL script), since you are using a SSDT project. Here's a link to some example code - in particular you may want to take a look at the 'Deploy-Dac' command.
If you are unfamiliar with .dacpacs as the (build) output of SSDT-created database projects, take a look at this reference link.
Edit: Although this doesn't answer the question in a plain SQL Server way, an easy Entity Framework approach would be the following: I found that I could create and destroy my database every time correctly by using the DbContext.Database.CreateIfNotExists() and DbContext.Database.Delete() methods in my setup and cleanup phases of my tests.
The fastest solution, while a bit of a hack, is really straightforward. You can set the DB Projects properties under the debugging tab to "always re-created DB". Then test in two clicks, do a debug/build, then run all tests. You should get a freshly built DB on localDB for you tests to be ran against. You can also change the target for the debugging DB (again the DB projects properties) to whatever you want, so you can deploy to a .dacpac, or to an existing SQL DB or wherever. It means testing in two steps, and if your build is long, it may be annoying, but it works. Otherwise, I believe scripting is your only option.

SQL Developer - No readers registered for SQL type error

I am using Oracle 11g. I had exported data using the installed version of SQL Developer to a sql file called "export.sql". Now, I have downloaded the new version which is 3.1.07 and when I try to import data by clicking on the tree view and choosing Tables | Import Data and navigating to "export.sql", I get the following error:
no readers are registered for the sql type
When I first started the application it asked for the path to java.exe and I have shown that path and application started. I have the started the application from the path where it was downloaded (C:\users\kaushik\Downloads\sqldeveloper)
You can call the file directly from sql developer.
Example: If you saved you file to c:\Oracle\MyBackups\Export.sql
Then from within Sql Developer, connect to your database and use the sql command:
#C:\Oracle\MyBackups\Export.sql
and that will execute the Export.Sql script.
If you have a valid SQL file, you simply need to execute the script. Open the file (File | Open and navigate to export.sql), hit the Run Script button (F5 on Windows), and choose the connection you want to use. The Data Import Wizard supports a number of different file formats (Excel, CSV, etc.). It doesn't support SQL files. If you want to ask the developers why they don't support SQL (or why they use the general file navigation dialog rather than using different dialogs for different sorts of files) you can ask them over in the SQL Developer forum on OTN. I assume the problem is that most SQL scripts contain much more than simple INSERT statements and it would be challenging to figure out whether any particular script was actually just a bunch of INSERT statements that could be used to import data.
Yes, SQL Developer is written in Java so you need to have an appropriate version of the JVM installed. Different SQL Developer download options include a bundled JVM or you can download a smaller file and use an already installed JVM.
One of oracle client tools to make session to database is sqlDeveloper and its graphical interface tool Programmed with Java Lang and its installed independently from oracle_home its a stand alone product and Of Course it needs SDK Or JDK to work
make sure to set the path and check it
read this link http://www.ehow.com/how_5127784_set-java-path.html
all of this if sql developer didn't run and other similar problem
this to answer
Is JDK is needed or what ? Yes
use sql Developer higher version
i am upgraded to Version 20.2.0.175
issue resolved

Attached SQL Express DB is causing problems

I have been asked to create an MVC web application in VS 2010, and was instructed to use a SQL express database for my data. I am using EF Code-First for creating and managing my data. The database was created in VS2010, and is attached via "AttachDBFilename" in the web.config.
I have used SQL CE before with MVC with no problems, however the attached SQL Express DB is causing weird issues.
For one thing, when I try to deploy the app, it fails and tells me that it cannot copy the database.mdf because it is in use by another process. I have NOT opened the database in VS2010 nor SSMS. Of course the program code accesses it - is there some reason that connection would remain open? I am using boilerplate code from the scaffolding.
I should mention that I use a ProjectInitializer.cs to create the sample data. It runs at every launch for the moment, since I am testing quite a bit.
The other problem I have is that if I delete the database, it fails to recreate it. It says that my windows account does not have access to the (now non-existent) database that it is trying to create. I literally have to create a new database with new name, as anything that was created previously (with that DB name) fails.
I assume there is some sort of residual info being left somewhere that is out of synch, but I don't know what it is. I've closed all connections to the file in VS 2010, deleted the files, both any found via VS2010 and any physical files I see in the app_data directory.
Any help or suggestions would be appreciated.
Shut down the web server (Cassini, IIS, IIS Express) and try again. The file can remain locked if the web process is still referencing the file. In addition the loaded EF context will retain the db name. Ensure the visual studio browser isn't running in the tray still either.

Resources