How can I determine the Stored Proc used on an SSRS page? - sql-server

We have an SSRS Report Server (I don't know if the name "Report Sever" is peculiar to us or common to SQL Server report services (IOW, I don't know if we chose it, or Microsoft did)) that hosts various queries that users can run against our data.
I need to find out which query is being run, probably which Stored Proc, for a given report that is available.
I thought I could suss that out via the "View Source" from the page, but I see no "data source," nor the name of our connection, or such. In fact, I looked through the entire source and saw nothing helpful.
The "View Report" button is:
<td><input type="submit" name="ReportViewerControl$ctl04$ctl00" value="View Report" id="ReportViewerControl_ctl04_ctl00" />
...and the only other reference to it is here:
Sys.Application.add_init(function() {
$create(Microsoft.Reporting.WebFormsClient._PromptArea, {"CredentialsLinkId":"ReportViewerControl_ctl04_ctl01","ParameterIdList":["ReportViewerControl_ctl04_ctl03","ReportViewerControl_ctl04_ctl05","ReportViewerControl_ctl04_ctl07","ReportViewerControl_ctl04_ctl09"],"ParametersGridID":"ParametersGridReportViewerControl_ctl04","ReportViewerId":"ReportViewerControl","ViewReportButtonId":"ReportViewerControl_ctl04_ctl00"}, null, null, $get("ReportViewerControl_ctl04"));
});
Is there a way, either from the "View Source" or otherwise, where I can coax out the SP used to generate the report?
UPDATE
Spurred on by Steve Mangiameli's comment, I see that I have the following in my Start menu:
MS SQL Server 2005
SQL Server Business Intelligence Development Studio (BIDS)
MS SQL Server 2008
SQL Server Installation Center
MS SQL Server 2012
SQL Server Data Tools
I don't know which, of any, of these has value for me in this quest.
UPDATE 2
We do have a Visual Studio 2005 project named "Report Server" project with many .rdl files beneath the "Reports" folder. I thought this was a unique-to-us solution, but maybe not.
Even if this is the "Report Server" mentioned, though, I still don't know which .rdl file is the one that drives the report I can generate via our online Report Viewer page.
It would be nice if the report, when generated, had some reference to the name of the related .rdl file.

You're going to want to navigate either Report Manager or the Report Server to download the report. Once you have the .rdl file, open it in a text editor...it's just an xml file. Simply perform a find for "dataset" and inspect the dataset values. You will see the datasource, parameter and SP. Use this link to help you navigate the site.
Adding a better link with pictures. I'd do it myself but don't have access to cloud services here at work.
http://sql-articles.com/articles/general/download-export-rdl-files-from-report-server/

The easiest way is to use Sql Profiler. Run Sql Profiler, put a trace on your Sql Server and run your report. You'll then see the exact SQL statement that is hitting the server.

Related

Migration of SQL server database to Azure

I'm trying to migrate one of my database in my local environment to Azure from SQL server management studio, but i'm facing with the following exception.
Please let me know how to resolve this issue. Thanks
Steps I have followed:
From SQL Server Management Studio, Database -> Tasks --> Deploy database to Windows Azure SQL Database
I'm able to connect to the Azure SQL instance
During the process i'm getting the following error, as in the snapshot.
PFB the snapshot of my local and azure SQL server instances,
Right click on the DB you are trying to copy, select "Generate scripts..." to open the "generate and Publish Scripts" wizard.
Click Next or "Choose Objects" from the navigation pane to the left. On the "Choose Objects" step you may want to select the specific tables/sprocs you want to copy, or you can just choose "Script entire database"
On the next page, I recommend selecting the "Save to a New Query Window" option. Then click "Advanced" in the top right corner and scroll to the bottom of the "General" section. The last item in this section is "Type of data to script". You will probably want to change this to "Schema and data" if you want to include the data in your script.
Click Next until it starts to generate the script. When the script is done, it will open a new query window with CREATE / INSERT statements and when you Execute, it will create a copy of your DB. HOWEVER, you will need to update the USE [MyDatabase] statement and you will need to change the "Available Databases" dropdown to the desired Database (i'm talking about the dropdown box above the Object Explorer)
You can use the following methods:
-dacpac
-In Visual Studio -> Tools - SQL Server - SQL Schema comparison & data comparison
Check in the settings windows - use incompatible platforms
You received that error because the version of SSMS you're using is old. Installing the latest version of SSMS will get things working better.

Columns node disappeared in SSMS

I'm using SSMS (from SQL Server 2014 Developer edition) to work with SQL Azure. It's running on Windows 10. I have a number of databases set up on Azure, and have always used SSMS to work with them. I have also installed devart's dbForge Studio for SQL and use that from time to time.
I've now hit a very weird problem. I was about to create a view, and clicked the + next to a table to expand the nodes below. Then I clicked the + next to columns and got a strange error as follows:
TITLE: Microsoft SQL Server Management Studio
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&LinkId=20476
ADDITIONAL INFORMATION:
unknown property IsMemoryOptimized (Microsoft.SqlServer.Management.Sdk.Sfc)
Having dismissed this error, everything seemed fine, however, until I noticed that I no longer have a Columns node under that table. Or indeed any table (see screenshot).
I tried the following trouble-shooting steps:
Restart SSMS. No change
Restart the PC. No change
Use the "Repair" option in the SQL Server Installation Center to repair the Management tools. No change
Then I tried connecting to another database entirely, and I can see columns again! But when I connect back to this one, no columns.
To be clear, the columns ARE there, I can use them in SELECT statements, and I can use Script table as --> Create and SSMS creates a script including all the column names.
I can also see the columns if I use DBForge instead of SSMS.
Anyone ever come across this? It's a real mystery to me, so I'm hoping someone here can help. Incidentally, I did follow the link in the error message above to see if there's more information, but no luck.
This is a bug in SSMS. Ensure that your SSMS 2014 is updated (https://www.microsoft.com/en-us/download/details.aspx?id=46694) or, even better, use the latest version of SSMS (http://blogs.msdn.com/b/sqlreleaseservices/archive/2015/09/01/announcing-sql-server-management-studio-august-2015-release.aspx).

Azure SQL Data Warehouse ''NoCount' Error

I just got approved for the Azure SQL Data Warehouse Preview, and just finished "provisioning" my new server and database. I followed a link to a 'Getting Started' page from Microsoft (Get started: Connect ...), and read that the two best (only?) ways of querying the database were through sqlcmd and Visual Studio 2013.
I ignored this advice first, and fired up SSMS, connected to the database, and then tried to open a new query window. I immediately received the following error: 'Unable to apply connection settings. The detailed error message is: 'NoCount' is not a recognized option.' After clicking OK, the query window did open up, but many T-SQL statements did not work such as a simple:
CREATE TABLE dbo.tblTest (acct_id nvarchar(255) NOT NULL)
I would receive a 'Command(s) completed successfully.' message, however no table was created.
Ok, I fired up Visual Studio 2013, connect to my Azure SQL Data Warehouse, and open it up in SQL Server Object Explorer. I right-clicked the specific database, and selected 'New Query', enter the same T-SQL CREATE TABLE statement as above, then hit execute. Once I hit execute, I get the exact same error message as above. This time around I was able to open a new query window at least, but after attempting to execute the query I still get the 'NoCount' is not a recognized option error.
I'm completely new to data warehouses, and still very much a beginner with T-SQL and SQL Server as well. But, I haven't been able to find anything that would explain why I'm receiving these errors, and right now I'm basically at a standstill until I can understand what's going on. Any help is appreciated, thanks.
I've experienced this. Your connection isn't actually recognised as a SQL DW connection. I bet your query window is a .sql file, not a .dsql as it needs to be.
Go back into the Azure portal and use the link to connect using SSDT from there. You should get a connection in the SQL Server Explorer pane which looks different, and when you start a New Query based on it, you should get a .dsql window, not a .sql one.
Have you checked the version of SSDT that you are using? It sounds like you may be on a version prior to 12.0.50623, which doesn't take into account that SET NO COUNT is not supported by SQL Data Warehouse at the moment. Newer versions of SSDT have adjusted for this. We recommend updating SSDT here and then connecting using the SQL Server Object Explorer with the directions in our documentation.
I am running Visual Studio 2015 Enterprise, and what I had to do to get this error resolved was install SSDT October 2015 Preview in Visual Studio. The link I used is: https://msdn.microsoft.com/en-us/library/mt204009.aspx
Prior to installing this, I had the latest released version for VS2015...had to install the Preview to get it to work. Also, it solved the issue where I was not able to see ANY of the tables in the Azure Data Warehouse database - just a couple of views, which made querying difficult (could still get a list of available tables from sys.tables)
I hope this helps somebody!

Error deploying database to SQL Azure

I'm using forms authentication to handle users and attempting to deploy my database to SQL Azure, but getting this error message:
The only table of the four listed that I utilize is aspnet_Membership, and the only other table I use is aspnet_Users from implementing forms authentication. What is TextInRowSize and why does SQL Azure care about it? Do I have any option to modify aspnet_Membership to make it compatible?
If it would be easier to remove the current system altogether and replace it with my own, I'm fine with that too.
That looks like an error in the data-tier application framework. I can suggest a workaround to get your database to Azure:
Use SqlPackage.exe (https://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx) from the command line to extract a dacpac file with all table data. Then use SqlPackage.exe to deploy that dacpac file to your database in Azure. The extract command would look something like:
C:\>"c:\Program Files\Microsoft SQL Server\120\DAC\bin\SqlPackage.exe" /a:extract /scs:"Data Source=yourSqlServer;Integrated Security=true;Initial Catalog=yourDatabase" /tf:C:\temp\mydatabase.dacpac /p:ExtractAllTableData=true
And the import command would look something like:
C:\>"c:\Program Files\Microsoft SQL Server\120\DAC\bin\SqlPackage.exe" /a:publish /tcs:"Data Source=yourAzureSQLServer.database.windows.net;User Id=yourUserId;Password=yourPassword;Initial Catalog=yourDatabase" /sf:C:\temp\mydatabase.dacpac
So quick suggestions since I see you are using V12 which should support those properties now.
First make sure you are using SSMS 2014 SP1 at least, this has a number of fixes for using V12. Secondly make sure you install the May 2015 update to DacFX (which is the program that creates bacpac files) you can install it here: http://www.microsoft.com/en-us/download/details.aspx?id=46898
This should get you to the best possible chance of your import/export working.
This was solved by generating a SQL Azure script for the DB, and running it on Azure. Here's how I solved it:
First, open SQL Server, right click the database you want to transfer and click "Tasks > Generate Scripts..."
Next, click "Advanced" on the scripting options panel and find the row "Script for the database engine type." Select "Windows Azure SQL Database" and click OK (Note: if you have data that you want to transfer as well, choose "Schema and Data" from the "Types of data to script" option).
Proceed thru the rest of the script generation dialog, remembering where you saved the script file. Connect to your database server using SQL Server or windowsazure.com. Generate a new query for your new database, enter the script that was generated by SQL Server and execute.
Seems like TextInRowSize stores large data for older SQL Server types such as text and ntext. You would need to change it's type to nvarchar(max).
Here's a link to a more detailed explanation.
http://www.dnnsoftware.com/wiki/unsupported-property-textinrowsize-set-and-is-not-supported-when-used-as-part-of-a-data-package

Can't gain access to my database created though Visual Studio?

I have created a database emailDatabase, its stored in
C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
In Visual Studio, I use the Server Explorer, click the add new connection button.
The add connection dialog box appears.
Under server name I use the dropdown box and select DEV-5\SQLEXPRESS. I use Windows authentication.
In the Connect to section at the bottom, the dropdown displays: Master, Model, msdb and tempdb and does not display my emailDatabase.
So I select Attach Database File and click browse and follow
local C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA
and select my email database.
The following error occurs :
emailDatabase
You don not have permission to open this file.
Contact file owner or an administrator to obtain permission.
I think my problem is i saved my database wrong, I need to make a back up or something like that. if that's the case please tel me how to make a backup and so on. I really need to move forward from this problem.
When I created my database I right-clicked on databases in SQL Server Management Studio and said new database, then I added columns with a query. then file save all.
How can I get a copy of my database file with all the permissions I need to use it in visual Studio??
When you create a database on the server (using SQL Server Management Studio), you don't have to (and should not!) fiddle around with the database file(s) anymore - let the server handle that for you.
Instead: do a Add Connection in Visual Studio and then specify the server instance (DEV-5\SQLEXPRESS) and the database name (emailDatabase) in your connection dialog.
With this, you're connecting and using a SQL Server database the way it's intended to be used - on the SQL Server instance itself. This is much easier, and much less hassle, than having to struggle with "free-floating" .mdf files and attaching them to your solutions and stuff like that....
So here - fill in DEV-5\SQLEXPRESS into your "Server name" dropdown, and then use the "Select or enter database name" option and enter your database name (or pick it from the dropdown) - it should be there!
DO NOT use the "Attach a database file" option - this is the free-floating .mdf "feature" which is rather clumsy and hard to use and error-prone - again: I recommend not using that...
Had the same problem and I realised the problem was not in VS2010 but my SQLserver.My instance name is OMAFANO ,and that's what my MSSQL connected to under Server Name. Now here's the catch,click on that and connect to OMAFANO\SQLEXPRESS and create all your databases and tables there if you want them to show up in VS2010 the way u stated up there. So under server name in VS2010 also write INSTANCENAME\SQLEXPRESS if you want to see your newly created databases etc. Take a look at the picture:
I thought I had it figured out but problems continue to pop up. So ...
IGNORE EVERYTHING BELOW THIS LINE.
After hours of tinkering I finally figured out how to use SSMS to connect to a SQLServer 2008 database that was created in VS2010, and it is relatively simple. But from the number of unanswered questions all over the place not well documented. Here's how to do it:
In VS right click the project in SolutionExplorer and select Add new item then select Data then SQLServer database. It will prompt you to save it in the app_data folder and create the folder for you if it doesn't exist.
Find the Ssms.exe file (on my system it's in C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE
Right click Ssms.exe and select Run as administrator.
After SSMS opens you can attach the project MDF. It will now be on your list of databases. The database name is a GUID.
You can even run aspnet_regsql against the database to add the Membership tables and sprocs.
IMPORTANT! You can manage this database with EITHER SMSS OR VS but not both at the same time. If you mess with the database from within VS using ServerExplorer you will break the SSMS connection. To fix that you will need to detach and reattach the database.
Run Your Visual studio As Administrator
Go to Visual Studio instance i.e C#,C++ etc
Right click > Run as Administrator
Then now It may work
To connect to a ssms2014 database from visual studio 2013, in the new connection wizard I had to change 'data source' from 'ms sql server database file' to '.net framework data provider for sql server..'. Then I was able to enter [computer name][username] for windows authentication.
I had the same issue, you just type your local server name "sara-PC" instead of
"sara-PC\SQLEXPRESS"
Now you can access your database easily, you can see it in your dropdownlist.
And also please dont use file access method to attatch database, thats not good way.
Also you can put ~....\Data and ~...\log file wherever you want by setting default location using server->rightclick->properties->Database settings.
Definitely this solves your issue.

Resources