Check rendered SQL sent to the server from SSDT/SSRS - reporting-services

I'm building a report in Visual Studio Data Tools and I'm having trouble in passing a multivalued parameter to a DB2 LUW server.
How to check the rendered SQL string sent to the server?

You can use the SQL Server Profiler to see the actual query. Or you can catch it in the query monitor in SSMS.
If you post more details someone might be able to see what's wrong. It usually has to do with how the WHERE clause is written.

Related

Does SSRS does support handling errors / exceptions?

I am trying to catch any error before the report is sent to subscribers.
If there is an error I would like to send a custom message like "server is in maintenance" or similar.
Microsoft Report Builder does not show any option to handle errors if SQL Server is down.
This is not possible within SSRS.
You could, if you like, have some routine which checks SQL Server is running.. But that is only one check. There are countless reasons why the report may not run.
I think you probably need to take a step back and look at what you are trying to achieve.
Subscriptions are stored as jobs on your server. You can write a query to check the details of these jobs. If your SQL Server is down, then nothing will work. But you could have a subscription that regularly reports errors which would fire off once the server is back online. I know this is a high level explanation, but it should point you in the right direction. Here's an article that may help get you started:
https://www.mssqltips.com/sqlservertip/1846/how-to-easily-identify-a-scheduled-sql-server-reporting-services-report/

Reporting services error trying to access a object that isn't called in the report

have a strange one. We are running Sql Server 11.0.3000. The report is giving an error
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'Audit_Detail'. (rsErrorExecutingCommand)
Invalid object name 'dbAudit.tblRangeReport'.
The thing is, the report uses 3 stored procs to go after data in a database called dbSalarySurvey. The three sp's do not mention the dbAudit.tblRangeReport. There are no functions or views in the 3 sp's that access that table. Further more, if i run the report in VS 2012 the report runs. If i run profiler on the dbAudit table when VS runs the report, the report does not query the dbAudit table. Only when running the report from the web browser do i get this error. This more detailed version of the error come from running the report on the Sql Server REporting services computer.
I have tried restarting the reporting services service. We have also deleted this one report from the reporting services server and republished it. Have also tried to republish the dataset. Other reports in this project that use the datasource and the same tables run.
Anyway, was wondering if anyone had any sugguestions.
Thanks
shannon
It's fixed. it was a pebkak error in the stored proc. It's really strange though. Honest to goodness, the proc was running in my dev env but not when running from a browser. I had already checked profiler like was suggested below and done the xml scan too. In the end.. just missed it i guess.
You need to trace the SQL to determine.
Are you connecting to the right database?
Are the procs you expecting to see, the ones actually being run?
The procs you are running are correct?
Open SQL Server Profiler
Start New Trace
Click Event Selection, Select the following events
Click - Show All columns
Go into Column Filters
and filter on your DB, and possibly even your login name (the login name of the SSRS server)
Once you've done that, call your report and look to make sure all the procs are called that you expect. Track issues from there.

Data in SQL Server 2008 Express edition does not show up after insert?

I have a SQL Server 2008 Express edition database and I am inserting data to it via a windows application, using Linq-to-SQL. I know the data exists in database because when I query the database I get some data but in SQL Server Management Studio when I right click on a table and click even : 'Edit top 200 rows' or 'Select top 1000 rows' I can not view any data ! any helps ?
Assuming you're using the User Instance and AttachDbFileName= approach - I would argue this approach is severely flawed. Visual Studio will be copying around the .mdf file and most likely, your INSERT works just fine - but you're just looking at the wrong .mdf file in the end!
If you want to stick with this approach, then try putting a breakpoint on the myConnection.Close() call - and then inspect the .mdf file with SQL Server Mgmt Studio Express - I'm almost certain your data is there.
The real solution in my opinion would be to
install SQL Server Express (and you've already done that anyway)
install SQL Server Management Studio Express
create your database in SSMS Express, give it a logical name (e.g. VictoryDatabase)
connect to it using its logical database name (given when you create it on the server) - and don't mess around with physical database files and user instances. In that case, your connection string would be something like:
Data Source=.\\SQLEXPRESS;Database=VictoryDatabase;Integrated Security=True
and everything else is exactly the same as before...
I believe LinqToSql has a "Save" command that actually writes the data to the database. Until that happens you are merely holding it in memory.
ETA: see this question and its answers

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...]

Does sql profiler show you the paramater values that were passed in?

I'm using this 3rd party sql tracing application because I have sql server express 2008 installed (just a trial version).
It only shows the sql passed into the server, with the parameters like #p1 and not that actual value of the parameter, which to me is not all that usefull.
Does the built in sql profiler show you the actual values the .net web app is passing in like '2342' or a = 200 ?
yes, it shows the query with the parameters already substituted. When I debug, I usually just copy the SQL from the profiler and paste it into Management Studio and run it.
It can. When you define a profile template, you can specify which sql "things" you want to see and which columns (information) you want to see for each "thing". So if you aren't seeing the parameters, you may have to modify the profile template you are using.