sql debugging in vs2010 confusion - sql-server-2008

After much work i've configured my machine (win 7 x64, VS2010, SQL 2008 R2) to be able to debug stored procedures locally from within visual studio. My question is about how the debugging context is supposed to switch as you debug.
an example:
when debugging and I call another vb class the debugger follows and jumps to that class for me to step through. when I hit a sql call is there a way to tell the debugger to follow it there too?
currently the only way I can debug a stored procedure is to right click it and choose "step into" and provide values. Those values I have to determine by running my app, making edits, and writing down my param values I was going to pass into the stored procedure. Then going back and stepping into the stored procedure with those values allows me to track and use intellesense to debug the sql stuff.
What i'm looking for though is to have the debugger do the switching for me. So I don't have to do as much work to step through stored procedures. When I run my application and open one of my stored procedures to view the breakpoint symbols are not loaded but it does say it has auto-attached to the sql process and everything.
Wasn't sure if this was how sql debugging was supposed to go or if I did something incorrectly. Figured someone here might know what was going on. Thanks for looking!

my target framework was dot net 4 client profile. When I swapped to full dot net 4 framework and rebuilt everything started working like I thought it should. My only guess is that some of the sql-clr debugging stuff is trimmed out of the client profile?

Try the following.
The standard workflow to debug a CLR SQL assembly is the following…
Right-Click the project and select ‘Deploy’
Debug | Attach to Process…
Select the Process ‘sqlservr.exe’ and make sure it is the one with a Type of ‘T-SQL, Managed, x86 or x64’
Press the Attach Button

Related

SQL Server 2008 R2 - Custom SSIS Components work in BIDS not in SQL Server Agent

We have developed Custom SSIS components that integrates with an online REST API (Shopify to be precise) and these components work fine in BIDS and every single time too. However, when I create a SQL Server Agent job for the SSIS package that uses the components, some of the components don’t work, there is no error, just never hits the Pre Execute. The components that don’t work call the REST API and set specific TAGS on some orders, they do so using a JSON. The SQL Server agent is running on the same machine (my own) and it's executing the same SSIS package that works in BIDS. There are no errors and the SQL Server JOB reports success.
My machine is a 64 bit setup, so obviously the Agent will be running in 64bit so there may be issues there.
This is what I have tried already
Changed the SQL Server Agent user to eliminate the issue being a proxy/user issue.
Changed the setting for the step to use 32bit runtime (Ticked “Use 32 bit runtime”)
I have tried compiling my code using Any CPU x86 x64 .. with different results but none of them work etc
The installation project (which is part of the solution) is a WIX Toolset project which can only compile using x86 which I don’t think I can change.
Logged where it is getting to a log file.
I think it might be 32bit/64bit issue but maybe wrong. The log file shows the following
When called from BIDS (works)
• Validate (code running as 32bit)
• Validate (code running as 32bit)
• Hits Pre Execute and it all works thereafter
When called from SQL Server Agent (doesn’t work)
• Validate (code running as 32bit)
• Validate (code running as 64bit)
• Never hits the Pre Execute
Like I said, I suspect it being a 64bit issue but maybe wrong.
Hi guys and sorry for not posting the answer.
First of all thank you for all your help, especially Nick McDermaid as you kept trying and trying. I really appreciated your pointers and without them I wouldn't have solved it ( kind of solved it :o) ).
My SSIS Custom components only work when I have a "Success path" coming out of them. This was only an issue on this particular occasion because it was the last component called in my Data Flow.
This could be down to a bug in my SSIS Custom Component but I am sure I have had this issue with other components in the past (I think it might have been the 'Send Mail Task').
If anyone comes across this issue again then I would love to hear from them.
I'm currently fire fighting at work so hadn't had a chance to look at the SSIS Custom Components again.
Once again, thanks for the help I received.
I realize this question is very old, but I thought I'd put in my answer. I just ran into this very issue and the answer was that the SSIS engine didn't see the custom component doing anything so it removed the component at runtime. I was able to get around this by changing the RunInOptimizedMode property of the Control Flow object to False. After this I was able to run the SSIS package as a SQL Agent job.
If you run the package through dtexec.exe as bilinkc suggested in your comments, it should give you messages that make it obvious if this is occurring.

Report Builder 3.0 Crash When Creating Dataset

Morning folks.
This problem is very isolated but very annoying. It only happens with one customer I do work for, and can happen when creating new datasets or amending existing ones, but doesnt happen every time.
So lets start with a new dataset. I right-click and Add Dataset, I give the dataset a name, select the data source and then select Stored Procedure. This is where the fun begins. I start to type the SP name and BOOM, Report Builder crashes. I know I can just pick off the list but in the case of this client, the list of SPs is massive, so starting to type the name narrows down the list.
This can also happen if I amended the name of an SP within an existing dataset.
It has to be something to do with configuration as this doesnt happen with any of my other customers. The only difference with this site is they use Citrix but I cant see how that would affect this.
So, Report Builder 3.0 connecting to a SQL Server 2008 R2 instance. Any suggestions?
Thanks in advance
It seems not the issue on SSRS side, please let the user connect the database and execute the SP directly to check the performance. It also can be some hardware or configuration issue on that client's machine. You can suggest him use Process Monitor to fetch some detail information.

Microsoft SQL Server Management Studio: creating scripts like in mySQLWorkbench

I just wanted to know if Microsoft's Studio has the following functionality of mySQLWorkbench:
After inserting, updating, deleting etc. cols in mySQLWorkbench using GUI, you clik on "Apply" and a new window pops up where you have your complete query according to changes you have made.
On the other side Microsoft's Server only offers that the user generates some predefined scripts, which should be changed manually each time.
So, perhaps i missed it, i want to be sure:
Does "Microsoft SQL Server Management Studio" offer the described functionality of "mySQLWorkbench" ?
mySQLWorkbench isn't primarily a Databse-Frontend, it's a Design- and Development IDE that could connect a Database-Server.
The Managementstudio is to manage and Maintain Servers. It#s intended to do a different Job though. But: you can do almost anything by drag and drop and by context menus you could get the resulting code to copy/paste or save it.
There is one important difference: With the Workbench you design in theory and might connect a server. With the MS SQL Management-Studio you always manipulate a real Server. That's why i've got here a Deploy Server, One Hot-Standby and a Developmentserver (Developeditions are quite cheap) for Development and Testing.
Transact SQL is something one should learn and understand as you will need it for stored procedures or trigger-programming. GUI clicking is nice to have, but at a certain point you will have to know what GUI is doing or will have to start your Editor. The Transact SQL Help is quite good. Just start!
Yes. Right-click on "Tables" and choose "New Table.." or right-click on an existing table and choose "Design". Make your changes in the designer, then right-click in the top pane and choose "Generate Change Script..."

SQL Server 2008 Debugger Attach?

I have seen a few posts here about using the native MSSQL 2008 functionality to debug and step through TSQL.
In a Visual Studio 2010 .NET C# console app, I use simple ADO.NET to send some params to a stored proc. I can run it in the debugger and see what happens in the .NET code up until the point where the SqlCommand is executed. How can I get the debugger (or any debugger) to fire on the MSSQL side so I can follow data from the C# all the way to/though the DB?
Thanks.
If you want to capture what is sent cross the wire, use SQL Profiler.
Using SQL Server Profiler
If you are having problems stepping into a stored procedure from Visual Studio:
How to: Enable Transact-SQL Debugging
Walkthrough: Debug a Transact-SQL Stored Procedure
[Please note: your mileage may vary; I've known systems where this just wouldn't work. So much so, I never try to step into TSQL any more...]

TFS Build partially succeeded when LINQ to SQL is added

VS2008 / TFS Build 3.5 / Ent Lib 4.1
I have a rather large solution that contains several apps. They are all currently using Enterprise Library (v.4.1) for their data access layer.
I added and locally tested a new data access layer that uses LINQ to SQL- it was fast and easy to add and the test went fine. But...
When I checked in the project, it would not complete the build - I get a "Partially Succeeded". There are some warnings, but those exact same warnings were there prior to the build failing.
I took the data access class back out (along with the code that calls it) and rebuilt and it builds fine.
I then added an empty new class and put a single variable in it and referenced it from the code. That built. I then created a new LINQ to SQL class in that new project and did not even reference it. When I checked that in, the build failed again with the "Partially Succeeded" message. No extra errors or warnings.
I love LINQ to SQL, I have used it in a few projects outside of this system, but I now have many hours into attempting to get this to build with no success.
Are all the same tools/libraries installed on the build server as on your desktop - Perhaps the server doesn't have the same vs or .net service pack level? Try running the build "manually" on the build server - load up the solution in Visual Studio on the server and execute the build within the IDE rather than under the TFS build system - this may report problems that you don't see so easily in the automated build.
Check the build log. Visual Studio often reports errors in the output pane text or build-server log text that are not picked up by the GUI error windows. So you will think a build succeeded but an output file has "quietly" not been generated. TFS build logs are usually huge so they are a pain to work through, so start by searching for keywords like "error" or the name of the project that fails rather than trying to read through line by line.
OK, we found it. The issue is on stack overflow elsewhere at
Visual Studio Setup and Deployment build fails with no errors
The issue is a bug in MS setup and deploy that breaks when it hits a line in the project that uses Linq. You have to comment out a line in the project to get it to work. Amazing, ridiculous, and no surprise.
Thanks for the input, it was that input that helped us get to the eventual answer (already on StackOverflow, but didn't have Linq in the title).