[Forum FAQ] How do i use xml stored in database as dataset in SQL Server Reporting Services?

Introduction
There is a scenario that users want to create SSRS report, the xml used to retrieve data for the report is stored in table of database. Since the data source is not of XML type, when we create data source for the report, we could not select XML as Data Source
type. Is there a way that we can create a dataset that is based on data of XML type, and retrieve report data from the dataset?
Solution
In this article, I will demonstrate how to use xml stored in database as dataset in SSRS reports.
Supposing the original xml stored in database is like below:
<Customers>
<Customer ID="11">
<FirstName>Bobby</FirstName>
<LastName>Moore</LastName>
</Customer>
<Customer ID="20">
<FirstName>Crystal</FirstName>
<LastName>Hu</LastName>
</Customer>
</Customers>
Now we can create an SSRS report and use the data of xml type as dataset by following steps:
In database, create a stored procedure to retrieve the data for the report in SQL Server Management Studio (SSMS) with the following query:
CREATE PROCEDURE xml_report
AS
DECLARE @xmlDoc XML;  
SELECT @xmlDoc = xmlVal FROM xmlTbl WHERE id=1;
SELECT T.c.value('(@ID)','int') AS ID,     
T.c.value('(FirstName[1])','varchar(99)') AS firstName,     
T.c.value('(LastName[1])','varchar(99)') AS lastName
FROM   
@xmlDoc.nodes('/Customers/Customer') T(c)
GO
P.S. This is an example for a given structured XML, to retrieve node values from different structured XMLs, you can reference here.
Click Start, point to All Programs, point to Microsoft SQL Server, and then click Business Intelligence Development Studio (BIDS) OR SQL Server Data Tools (SSDT). If this is the first time we have opened SQL Server Data Tools, click Business Intelligence
Settings for the default environment settings.
On the File menu, point to New, and then click Project.
In the Project Types list, click Business Intelligence Projects.
In the Templates list, click Report Server Project.
In Name, type project name. 
Click OK to create the project. 
In Solution Explorer, right-click Reports, point to Add, and click New Item.
In the Add New Item dialog box, under Templates, click Report.
In Name, type report name and then click Add.
In the Report Data pane, right-click Data Sources and click Add Data Source.
For an embedded data source, verify that Embedded connection is selected. From the Type drop-down list, select a data source type; for example, Microsoft SQL Server or OLE DB. Type the connection string directly or click Edit to open the Connection Properties
dialog box and select Server name and database name from the drop down list.
For a shared data source, verify that Use shared data source reference is selected, then select a data source from the drop down list.
Right-click DataSets and click Add Dataset, type a name for the dataset or accept the default name, then check Use a dataset embedded in my report. Select the name of an existing Data source from drop down list. Set Query type to StoredProcedure, then select
xml_report from drop down list.
In the Toolbox, click Table, and then click on the design surface.
In the Report Data pane, expand the dataset we created above to display the fields.
Drag the fields from the dataset to the cells of the table.
Applies to
Reporting Services 2008
Reporting Services 2008 R2
Reporting Services 2012
Reporting Services 2014
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

I have near about 30 matrics. so I need a paging. I did every thing as per this post and it really works for me.
I have total four columns. On one page it should show three and the remaining one will be moved to next page.
Problem occurs when in my first row i have 3 columns and in next page if I have one columns then it show proper on first page but on second page also it gives me three columns insted of one. the first column data is exactly what I have but in remaining two
columns it shows some garbage data.
I have data like below.
Metric ColumnNo RowNo
1 1
1
2 2
1
3 3
1
4 1
2
so while grouping i have a row parent group on RowNo and Column group on ColumnNo.
can anyone please advice on this.

Similar Messages

  • [Forum FAQ] How do I add an average line to series group on SQL Server Reporting Services column chart?

    Introduction
    In SQL Server Reporting Service (SSRS), you may need an average value on column chart.
    For the above chart, add an average score line to the chart, you can get which student’s score is larger than average score, and which student’s score is less than average score clearly. This document demonstrates how to add an average line to series groups
    on SSRS column chart.
    Solution
    To achieve this requirement, you can add another values to the chart, change the chart type to line chart. Set the value to average value of the series group and set the line to show only once by using expression. Please refer to the link below to see the
    detail steps.
    Click the chart to display the Chart Data pane.
    Add Score field to the Values area.
    Right-click the new inserted Score1 and select Change Chart Type. And then change chart type to line chart in the Select Chart Type window.
    Change the Category Group name to Subject. Here are the screenshot for you reference.
    Right-click the new inserted Score1 and select Series Properties.
    Click the expression button on the right of Value field textbox, type the expression below:
    =Avg(Fields!Score.Value,"Subject"))
    Click Visibility in the left pane, select “Show or hide based on an expression”, and type in the expression below:
    =IIF(Fields!Name.Value="Rancy",FALSE,TRUE)
    Name in the expression is one of the Students. Then only one line chart is be displayed by using this expression.
    Click Legend in the left pane, type Average_Score to the Custom legend text box.
    The report looks like below:
    Applies to
    Microsoft SQL Server 2005
    Microsoft SQL Server 2008
    Microsoft SQL Server 2008 R2
    Microsoft SQL Server 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • How to print pdf file in SQL Server Reporting services report using command prompt?

    Is there a way to automatically print a SQL Server Reporting services report on command prompt? For eg: We can save a pdf file using rs.exe utility. I want to print a pdf using rs.exe utility. Is it possible? I don't want to install any 3rd party software.

    Thanks Simon for replying to my question.
    In oracle form, there is oracle command to print the report from command prompt with the help of rwrun.exe
    e.g: rwrun.exe   REPORT="D:\Test\REP_25\MLA.REP" DESNAME="testprinter" DESTYPE="PRINTER" P_FORMNAME="MLA.FMX" P_SPRACHE="E" P_SPRACHE_NR2="1" P_WHERE_BEDINGUNG="order by land_nr" USERID="test/test.world" PSV_NAME="PSV_DEMO" PSV_JOB_ID="PS$9583" RECURSIVE_LOAD="NO"
    BATCH="YES" NONBLOCKSQL="NO" ARRAYSIZE="1" PARAMFORM="NO" ERRFILE="c:\temp\psv16.tmp"<
    and to save the report we just need to change DESNAME="c:\temp\OC_100001349.pdf" DESTYPE="FILE" in above command instead of DESNAME="testprinter" DESTYPE="PRINTER".
    DESNAME and DESTYPE are the input parameters of the respective report.
    In SSRS, we can run the file from the command prompt and save it.
    rs -i "C:\Users\pujarswa\Documents\reports\new\LoadReport.rss" -s ww2004760:80/ReportServer_MSSQL -v fileName="C:\Users\pujarswa\Desktop\TipsReportLoad.pdf"
    -v reportPath="/TipsReport/LoadListTabular" -t -v format="PDF" -v LandNr=4 -u ap\swati -p test@# -e Exec2005
    But we cannot use same command for printing as you said we need to create another script for printing files.
    I have gone through the links but I dont want to use Adobe Acrobat Reader exe for printing because client it may not have Adobe Acrobat Reader on their machine.
    Also I want to pass a input parameter as type="Printer" to my report which will print directly for me and same I can acheive in command prompt passing type="Printer" fileName="C:\Users\pujarswa\Desktop\TipsReportLoad.pdf"

  • [Forum FAQ] The Reporting Server cannot be reinstalled on a same SQL Server Reporting Service instance

    Symptom: Sometimes, when you want to reinstall the Reporting Server Role for Operation Manager 2012,
    but you may encounter an issue that the Reporting Server Role cannot be reinstalled after you successfully uninstall it. When you check the System Center Operation Manager installation log, you can find the following error as shown in Figure 1.
    Figure 1: Reporting Server Role cannot be reinstalled
    It seems that the SQL Server Reporting Service has not been configured properly. When you open Reporting Services Configuration Manager to check the settings, the settings seem fine though.
    Even you recreate Reporting Service Database, the error remains.
    After reviewing the OpsMgrSetupWizard.log, we get the following errors when wizard try to connect to SQL Server Reporting Instance (Figure 2).
    [07:24:05]:    Error:  :CheckHttpAddressResponse failed: Threw Exception.Type: System.Net.WebException, Exception Error Code: 0x80131509, Exception.Message:
    The remote server returned an error: (500) Internal Server Error.
    [07:24:05]:    Error:  :StackTrace:   at System.Net.HttpWebRequest.GetResponse() at Microsoft.EnterpriseManagement.OperationsManager.Setup.ReportingComponent.CheckHttpResponseFromSRSUrl(String
    httpSite)
    Figure 2: Error Log -1
    It indicates the Reporting Service encounters an internal error. The Website cannot handle the request. So you may check the Reporting Service log which is located in C:\Users\Administrator.SCOM2012\AppData\Local\SCOM\LOGS
    and the following errors may be found (Figure 3).
    library!ReportServer_0-18!1448!03/30/2014-02:53:23:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException:
    Unable to load assembly Microsoft.EnterpriseManagement.Reporting.Security, Microsoft.ReportingServices.Diagnostics.Utilities.ServerConfigurationErrorException: The report server has encountered a configuration error.  ---> System.IO.FileNotFoundException:
    Could not load file or assembly 'Microsoft.EnterpriseManagement.Reporting.Security' or one of its dependencies. The system cannot find the file specified.
    File name: 'Microsoft.EnterpriseManagement.Reporting.Security'
    Figure 3: Error Log -2
    Reason: After the Reporting Server is installed on a SSRS instance, the Reporting Server of SCOM
    needs to modify the web.config and rsreportserver.config  file to add its own assembly to make the Reporting Server work. But it does not change it back when Reporting Server is uninstalled. So the assembly cannot be loaded and the SSRS cannot respond
    our requests.
    Resolution:  When the Reporting Server is installed, the old web.config and rsreportsserver.config
    files will be backed up to web.config1 and rsreportsserver.config1. So you just need to change the files’ name back, then try to install Reporting Server of SCOM again. Everything would go smoothly. 
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Hi AakashGhare,
    According to your error message, SQL Server 2008 databases are version 655. SQL Server 2008 R2 databases are 661. When you are trying to attach an 2008 R2 database (v. 661) to an 2008 instance and this is not supported. As other post, once the database has
    been upgraded to an 2008 R2 version, it cannot be downgraded. You'll have to either upgrade your 2008 SP2 instance to R2, or you have to copy out the data in that database into an 2008 database (such as using the data migration wizard).
    In addition, if you want to use a Windows Batch file code and command to automatically login to SQL Server, detach database and attach a new one database, there is a similar details about batch code for attaching database to a new database, you can refer
    to this article.
    http://notesbyparth.wordpress.com/2012/06/29/run-sql-commands-from-windows-batch-file-or-attachdetach-database-automatically-using-batch-script/
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • How do I post to SQL Server Reporting services

    Hi
    I have been using MS forums for almost 20 years but in the current incarnation I find it utterly imnpossible to post to anywhere useful.
    I have a serious issue I need to resolve with SQL Server reporting services but cannot find how to get this message posted because the options I get when trying to post in "FORUM CATEGORY" seem utterly unrelated to what I am doing.
    What can I do?
    Kind regards
    Jonathan
    jc

    Looks like you figured it out. Let us know if not.
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • SQL Server Reporting Services FAQ

    Hi All,
    This thread is a summary of the Frequently Asked Questions on SQL Server Reporting Services. We consolidate them and post here for your reference. If you have any further questions, please kindly start a new thread so that more community members, MVPs, and MSFTs can join the discussion and share their ideas. Thanks for your understanding.
    Part I: SQL Server Reporting Services General Topics
    1. How to migrate SQL Server 2008 Reporting Services to another computer?
    2. How to combine connecting string via parameter?
    3. How to install a 32-bit version of SQL Server 2005 Reporting Services on a computer that is running a 64-bit version of Windows?
    4. Error of EXECUTE permission denied on object 'xp_sqlagent_notify'.
    5. Security consideration for anonymous access to Report Server.
    6. How to create a custom report template in Reporting Services?
    7. Does Reporting Services support horizontal tables which have fixed rows and dynamic columns?
    8. How to reset the page number back to 1 every time the report gets a group break?
    9. How to open the drill- through report in a new browser window?
    10. How to verify the version of SQL Server?
    11. How to use multiple datasets?
    12. How to upgrade report from SQL Server 2000 to SQL Server 2005?
    13. Out of memory error when exporting reports to Excel.
    14. How to improve PDF quality of the report exported in Reporting Services 2005?
    15. How to enable the Select All option for a multi-value parameter?
    Part II: SQL Server Reporting Services SharePoint Integrated Mode Topics
    1. How to deploy reports to SQL Server Reporting Services in SharePoint Services integrated mode?
    2. How to integrate SQL Server Reporting Services and SharePoint Services?
    3. How to refer the reports on the Report Server in SharePoint Services?
    4. How to manage user to view reports in SharePoint integrated mode?
    5. What information is needed when posting questions regarding SharePoint integrated mode?
    6. Is Report Builder available in SharePoint Integrated Mode?
    PLEASE NOTE: Microsoft does not offer formal support for the communities you'll find here. Instead, our role is to provide a platform for people who want to take advantage of the global community of Microsoft customers and product experts. Microsoft may monitor content to ensure the accuracy of the information you'll find, but any information provided by Microsoft staff is offered "AS IS" with no warranties, and no rights are conferred. You assume all risk for your use.
    Microsoft Online Community Support

    1.        Question 3: How to install a 32-bit version of SQL Server 2005 Reporting Services on a computer that is running a 64-bit version of Windows?
    Answer: 
    To install the 32-bit version of Reporting Services on a computer that is running the 64-bit version of IIS 6.0, we can follow these following steps:
    1.       Uninstall the 64-bit version of Reporting Services.
    Note: Side-by-side installations of 32-bit versions of Reporting Services and 64-bit versions of Reporting Services are not supported.
    2.       Run the Dotnetfx64.exe file to manually install the .NET Framework.
    The Dotnetfx64.exe file is in the Tools\redist\2.0 folder on the SQL Server 2005 Setup media. To download the Dotnetfx64.exe file, visit the following Microsoft Web site:
    http://go.microsoft.com/fwlink/?LinkId=70186
    3.       In IIS Manager, click Web Server Extensions.
    4.       In the Details pane, right-click ASP.NET V2.0.50727, and then click Allow.
    5.       Right-click Web Sites, and then click Properties.
    6.       Click the ISAPI Filters tab.
    7.       In the Filter Name column, click ASP.NET_2.0.50727, and then click Edit.
    8.       Replace C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_filter.dll with C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll.
    Note: The Aspnet_filter.dll file in the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ folder is a 32-bit version of the file.
    9.       Click OK two times, and then close IIS Manager.
    10.   At a command prompt, run the following command:
    cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1
    11.   Install the 32-bit version of Reporting Services.
    12.   After setup is complete, open IIS Manager, and then click Web Server Extensions.
    13.   In the Details pane, right-click ASP.NET V2.0.50727 (32-bit), and then click Allow.
    To install the 32-bit version of Reporting Services on a computer that is running the 64-bit version of IIS 7.0, follow these steps:
    1.       Enable ASP.NET and IIS before you install Reporting Services.
    2.       Open a command prompt. To do this, click Start, point to All Programs, point to Accessories, right-click Command Prompt, and then click Run as administrator.
    3.       In the User Account Control dialog box, click Continue.
    4.       Copy the following script:
    cscript %SystemDrive%\inetpub\AdminScripts\adsutil.vbs set w3svc/AppPools/Enable32bitAppOnWin64 1
    5.       In the upper-left corner of the Command Prompt window, right-click the command prompt icon, click Edit, and then click Paste.
    6.       Press ENTER to run the script.
    7.       Install the 32-bit version of Reporting Services. You must apply SQL Server 2005 Service Pack 2 (SP2) after you install Reporting Services in Windows Vista. If you install SQL Server 2005 Express Edition with Advanced Services, you can run SQL Server 2005 Express Edition with Advanced Services SP2.
    For more information, visit the following Microsoft Web site:
    Microsoft SQL Server 2005 Express Edition with Advanced Services Service Pack 2
    http://go.microsoft.com/fwlink/?LinkID=63922
    8.       Reset IIS.
    9.       Configure the report server for local administration. To access the report server and Report Manager locally, follow these steps:
    a.       Start Microsoft Internet Explorer.
    b.      On the Tools menu, click Internet Options.
    c.       Click Security.
    d.      Click Trusted Sites.
    e.      Click Sites.
    f.        Under Add this website to the zone, type http://servername.
    g.       If you are not using HTTPS for the default site, click to clear the Require server certification (https:) for all sites in this zone check box.
    h.      Click Add.
    i.         Repeat steps f and g to add http://localhost, and then click Close.
    10.   This step lets you start Internet Explorer either to localhost or to the network computer name of the server for both Report Server and Report Manager.
    a.       Create role assignments that explicitly grant you full-permissions access. To do this, follow these steps:  
    b.      Start Internet Explorer by using the Run as administrator option. To do this, click Start, click All Programs, right-click Internet Explorer, and then click Run as administrator.
    c.       Start Report Manager.
    d.      Note By default, the Report Manager URL is http://servername/reports. If you are using SQL Server 2005 Express Edition with Advanced Services SP2, the Report Manager URL is http://servername/reports$sqlexpress. If you are using a named instance of Reporting Services, the Report Manager URL is http://servername/reports$InstanceName
    e.      On the Home page, click Properties.
    f.        Click New Role Assignment.
    g.       Type a Windows user account in the following format: domain\user
    h.      Click to select the Content Manager check box.
    i.         Click OK.
    j.        In the upper-right corner of the Home page, click Site Settings.
    k.       Click Configure site-wide security.
    l.         Click New Role Assignment.
    m.    Type a Windows user account in the following format: domain\user
    n.      Click to select the System Administrator check box.
    o.      Click OK.
    p.      Close Report Manager.
    11.   Open Report Manager in Internet Explorer without using the Run as administrator option.
    Microsoft Online Community Support

  • Use parameters in SQL Server reporting services with sharepoint lists

    I want to make report from sharepoint 2010 list and forms library in sql server reporting services.
    but also want to apply parameters.
    I tried but parameters but it is not working.
    How I can apply sharepoint lists parameters in sql server reporting services ?
    How to run or view report of sharepoint lists or form library in sqlserver reporting services with required parameters?

    Hi John,
    When we use SharePoint list as datasource in SSRS it has two method to add parameter. Suppose we have a dataset (DataSet1) get data from SharePoint list. Please refer to the methods below.
    Method 1: We can add parameter in the Query Designer dialog box to add parameter.
    Click “Add Filter” icon in the “Applied filters” dialog box in Query Designer.
    Select the corresponding field (Title), fill with specific conditions, and select Parameter option in the end of the row.
    Create a dataset (DataSet2) fill with Title field.
    Double click the parameter we create above, set the available values from DataSet2 field Title.
    (Note: In the situation, we are get the single-value parameter.)
    Method 2: It is a general method to add parameter in SSRS report.
     Create another dataset (DataSet2) in the report fill with Title field.
    Add a parameter (Title) get available values from DataSet2 Title field.
    Add filter in the DataSet1.
    (Note: This method, we can configure multi-values parameter.)
    Reference:
    http://technet.microsoft.com/en-us/library/aa337432(v=sql.105).aspx
    If you have any questions, please feel free to let me know.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How to change Rendering Extension in sql server Reporting Services based on User Permissions

    Hi,
    I want to provide SQL server reporting services rendering extension based on user Access.
    For Example
    User1 can have options of Rendering to EXCEL and PDF
    User2 can have a option of CSV
    i read one article which is useful for report basis rendering extension changes. but i want to give user basis rendering options.
    http://www.mssqltips.com/sqlservertip/3569/how-to-change-rendering-extensions-in-sql-server-reporting-services/?utm_source=dailynewsletter&utm_medium=email&utm_content=headline&utm_campaign=20150406
    Thanks in advance.
    GVRSPK VENI

    You can use a data driven subscription for that
    Maintain a table with rendering extension information for various users ie their AD user login. Then setup a data driven subscription based on table values
    You will be creating a dataset with query for retrieving userid as well as rendering extensions and then just set the value as Get value from database for  render Format and To properties 
    For more details refer
    http://beyondrelational.com/modules/2/blogs/101/posts/13460/ssrs-60-steps-to-implement-a-data-driven-subscription.aspx
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • How to show or publish the TFS - SQL Server Reporting Services reports in SharePoint dashboard?

    Hello,
    We have configured SharePoint site and SSRS for a team project.
    Foll. is the SharePoint site for the team project. When we click on the REPORTS link, it redirects us to the SQL Server Reporting Services website.
    My question is: How can I show or publish the reports from  SQL Server Reporting Services into SharePoint so that I can view the reports on SharePoint dashboard rather than having to go to the SSRS URL?

    Hi Nachiket,
    If you configure Reporting service for your TFS, then you can view the reports in report manger site when you click click report on Team Explorer. And SharePoint is a collaboration website product that offers deep integration with Office products like Word,
    Outlook, and Excel. You can save your team project related files in your SharePoint site. Check this
    page for more details.
    If you want to view reports that generated by reporting service on your SharePoint site, you might need to save the report in Excel and upload it to SharePoint site.
    Best regards, 

  • SQL Server Reporting Services installed on a production database server used to support JD Edwards EnterpriseOne. What performance isses can arise

    SQL Server Reporting Services installed on a production database server used to support JD Edwards EnterpriseOne. What performance isses can arise. Is it recommended. What are the pros and cons

    Hi hazelannc, 
    I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated. Thank you for your understanding and support.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to align the text in justify format with SQL Server Reporting Services?

            How to align the text in justify format In SQL server Reporting Services? Is there any code to do so?

    Hi,
    I'm afraid that if you want to have this kind of functionality, you will need to write a custom control. Here is an example: http://msdn2.microsoft.com/en-us/library/ms345265.aspx. The issue with custom controls is that it needs to be known by all the reportservers that will render your report.
    Greetz,
    Geert
    Geert Verhoeven
    Consultant @ Ausy Belgium
    My Personal Blog

  • [Forum FAQ] How do I restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity

    Question
    Background: When restoring Full + DIFF backups of a Change Data Capture (CDC) enabled database to a different SQL server, the CDC integrity is not being maintained. We did RESTORE the databases with the KEEP_CDC option.
    How do I successfully restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity?
    Answer
    When restoring a CDC enabled database on a different machine that is running SQL Server, besides using use the KEEP_CDC option to retain all the CDC metadata, you also need to add Capture and Cleanup jobs. 
    In addition, as you want to restore FULL + DIFF backups of a CDC enabled database, you need to note that the KEEP_CDC and NoRecovery options are incompatible. Use the KEEP_CDC option only when you are completing the recovery. I made a test to display
    the whole process that how to restore the CDC enabled database backups (FULL + DIFF) on a different machine.
    Create a database named ’CDCTest’ in SQL Server 2012, then enable the CDC feature and take full+ differential backups of the database.
    -- Create database CDCTest
    CREATE DATABASE [CDCTest] ON  PRIMARY
    ( NAME = N'CDCTest ', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest.mdf' , SIZE = 5120KB ,
    MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
     LOG ON
    ( NAME = N'CDCTest _log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest _log.LDF' , SIZE = 3840KB ,
    MAXSIZE = 2048GB , FILEGROWTH = 10%)
    GO
    use CDCTest;
    go
    -- creating table
    create table Customer
    custID int constraint PK_Employee primary key Identity(1,1)
    ,custName varchar(20)
    --Enabling CDC on CDCTest database
    USE CDCTest
    GO
    EXEC sys.sp_cdc_enable_db
    --Enabling CDC on Customer table
    USE CDCTest
    GO
    EXEC sys.sp_cdc_enable_table
    @source_schema = N'dbo',
    @source_name = N'Customer',
    @role_name = NULL
    GO
    --Inserting values in customer table
    insert into Customer values('Mike'),('Linda')
    -- Querying CDC table to get the changes
    select * from cdc.dbo_customer_CT
    --Taking full database backup
    backup database CDCTest to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTest.bak'
    insert into Customer values('David'),('Jane')
    -- Querying CDC table to get the changes
    select * from cdc.dbo_customer_CT
    --Taking differential database backup
    BACKUP DATABASE CDCTest TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTestdif.bak' WITH DIFFERENTIAL
    GO
    Restore Full backup of the ‘CDCTest’ database with using KEEP_CDC option in a different server that is running SQL Server 2014.
    Use master
    Go
    --restore full database backup
    restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak' with keep_cdc
    Restore Diff backup of the ‘CDCTest’ database.
    Restore Database CDCTest From Disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak'
        With Move 'CDCTest' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest.mdf',
            Move 'CDCTest _log' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest _log.LDF',
            Replace,
            NoRecovery;
    Go
    --restore differential database backup
    restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTestdif.bak' with keep_cdc
    Add the Capture and Cleanup jobs in the CDCTest database.
    --add the Capture and Cleanup jobs
    Use CDCTest
    exec sys.sp_cdc_add_job 'capture'
    GO
    exec sys.sp_cdc_add_job 'cleanup'
    GO
    insert into Customer values('TEST'),('TEST1')
    -- Querying CDC table to get the changes
    select * from cdc.dbo_customer_CT
    Reference
    Track Data Changes (SQL Server)
    Restoring a SQL Server database that uses Change Data Capture
    Applies to
    SQL Server 2014
    SQL Server 2012
    SQL Server 2008 R2
    SQL Server 2008
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Question
    Background: When restoring Full + DIFF backups of a Change Data Capture (CDC) enabled database to a different SQL server, the CDC integrity is not being maintained. We did RESTORE the databases with the KEEP_CDC option.
    How do I successfully restore the CDC enabled database backups (FULL + DIFF) while maintaining the CDC integrity?
    Answer
    When restoring a CDC enabled database on a different machine that is running SQL Server, besides using use the KEEP_CDC option to retain all the CDC metadata, you also need to add Capture and Cleanup jobs. 
    In addition, as you want to restore FULL + DIFF backups of a CDC enabled database, you need to note that the KEEP_CDC and NoRecovery options are incompatible. Use the KEEP_CDC option only when you are completing the recovery. I made a test to display
    the whole process that how to restore the CDC enabled database backups (FULL + DIFF) on a different machine.
    Create a database named ’CDCTest’ in SQL Server 2012, then enable the CDC feature and take full+ differential backups of the database.
    -- Create database CDCTest
    CREATE DATABASE [CDCTest] ON  PRIMARY
    ( NAME = N'CDCTest ', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest.mdf' , SIZE = 5120KB ,
    MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
     LOG ON
    ( NAME = N'CDCTest _log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\ CDCTest _log.LDF' , SIZE = 3840KB ,
    MAXSIZE = 2048GB , FILEGROWTH = 10%)
    GO
    use CDCTest;
    go
    -- creating table
    create table Customer
    custID int constraint PK_Employee primary key Identity(1,1)
    ,custName varchar(20)
    --Enabling CDC on CDCTest database
    USE CDCTest
    GO
    EXEC sys.sp_cdc_enable_db
    --Enabling CDC on Customer table
    USE CDCTest
    GO
    EXEC sys.sp_cdc_enable_table
    @source_schema = N'dbo',
    @source_name = N'Customer',
    @role_name = NULL
    GO
    --Inserting values in customer table
    insert into Customer values('Mike'),('Linda')
    -- Querying CDC table to get the changes
    select * from cdc.dbo_customer_CT
    --Taking full database backup
    backup database CDCTest to disk = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTest.bak'
    insert into Customer values('David'),('Jane')
    -- Querying CDC table to get the changes
    select * from cdc.dbo_customer_CT
    --Taking differential database backup
    BACKUP DATABASE CDCTest TO DISK = 'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Backup\ CDCTestdif.bak' WITH DIFFERENTIAL
    GO
    Restore Full backup of the ‘CDCTest’ database with using KEEP_CDC option in a different server that is running SQL Server 2014.
    Use master
    Go
    --restore full database backup
    restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak' with keep_cdc
    Restore Diff backup of the ‘CDCTest’ database.
    Restore Database CDCTest From Disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTest.bak'
        With Move 'CDCTest' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest.mdf',
            Move 'CDCTest _log' To 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\DATA\CDCTest _log.LDF',
            Replace,
            NoRecovery;
    Go
    --restore differential database backup
    restore database CDCTest from disk = 'C:\Program Files\Microsoft SQL Server\MSSQL12.SQL2014\MSSQL\Backup\CDCTestdif.bak' with keep_cdc
    Add the Capture and Cleanup jobs in the CDCTest database.
    --add the Capture and Cleanup jobs
    Use CDCTest
    exec sys.sp_cdc_add_job 'capture'
    GO
    exec sys.sp_cdc_add_job 'cleanup'
    GO
    insert into Customer values('TEST'),('TEST1')
    -- Querying CDC table to get the changes
    select * from cdc.dbo_customer_CT
    Reference
    Track Data Changes (SQL Server)
    Restoring a SQL Server database that uses Change Data Capture
    Applies to
    SQL Server 2014
    SQL Server 2012
    SQL Server 2008 R2
    SQL Server 2008
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

  • [Forum FAQ] How do I send an email to users when the data in the report have been changed in Reporting Services?

    Introduction
    There is a scenario that the data in the report changes infrequently, so the users want to be informed and get the most updated data once the data changes. By default, report server always run the report with the most recent data. Is there a way that we
    can subscribe the report, so that we can send an email to users when the data in the report has been changed?
    Solution
    To achieve this requirement, we can create a subscription for the report, then create a trigger in the table which including the report data. When this table has data insert, update or delete, it will be triggered and execute the subscription to send email
    to users.
    In the Report Manager, create a subscription for the report and make it only execute one time.
    When we create a subscription, a corresponding SQL Agent job will be created. Then we can use the query below to find out the job based on ScheduleId:
    -- List all SSRS subscriptions
    USE [ReportServer];  -- You may change the database name.
    GO 
    SELECT USR.UserName AS SubscriptionOwner
          ,SUB.ModifiedDate
          ,SUB.[Description]
          ,SUB.EventType
          ,SUB.DeliveryExtension
          ,SUB.LastStatus
          ,SUB.LastRunTime
          ,SCH.NextRunTime
          ,SCH.Name AS ScheduleName   
              ,RS.ScheduleId
          ,CAT.[Path] AS ReportPath
          ,CAT.[Description] AS ReportDescription
    FROM dbo.Subscriptions AS SUB
         INNER JOIN dbo.Users AS USR
             ON SUB.OwnerID = USR.UserID
         INNER JOIN dbo.[Catalog] AS CAT
             ON SUB.Report_OID = CAT.ItemID
         INNER JOIN dbo.ReportSchedule AS RS
             ON SUB.Report_OID = RS.ReportID
                AND SUB.SubscriptionID = RS.SubscriptionID
         INNER JOIN dbo.Schedule AS SCH
             ON RS.ScheduleID = SCH.ScheduleID
    ORDER BY USR.UserName
             ,SUB.ModifiedDate ;
    Create a trigger in the table which including the report data.
    CREATE TRIGGER reminder
    ON test.dbo.users
    AFTER INSERT, UPDATE, DELETE
    AS
    exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    Please note that the command ‘exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'’ is coming from the job properties. We can go to SQL Server Agent Jobs, right-click the corresponding job to open
    the Steps, copy the step command, and then paste it to the query.
    Then when the user table has data insert, update or delete, the trigger will be triggered and execute the subscription to send email to users.
    References:
    Subscriptions and Delivery (Reporting Services)
    Internal Working of SSRS Subscriptions
    SQL Server Agent
    Applies to:
    Reporting Services 2005
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • How to use Microsoft Excel dll in SQL Server Reporting Services

    Hi,
    Can you please explain me the steps to use excel .dll in ssrs

    Hi PrakashThandra,
    Based on my understanding, you have created a chart in Excel, then you want to use this chart in Reporting Services, right?
    In Reporting Services, it’s not supported to use a chart which created in Excel directly. But we can use Excel as datasource to create a report, please refer to this article:
    Create SSRS report using Excel Data Source Step by Step. In your scenario, since you want to use the Excel chart in Reporting Services, you could create a same report in Reporting Services refer to this article:
    Charts (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Can Centura SQL Base Can be Used as a Source for SQL Server Reporting Services

    I have bunch of Centura Report Builder and need to show them inside .NET WPF UI. I was thinking to convert those reports to SSRS and then show. But database here is SQL Base
    and want to know whether SSRS supports SQL Base as a source. Also let me know is there a way to show Centura Report Builder inside WPF without converting to SSRS.

    Hi JAISH,
    In Reporting Services, a set of data processing extensions are automatically installed and registered on both the report authoring client and on the report server to provide access to a variety of data source types. But the SQLBase is not included.
    However, custom data processing extensions and standard Microsoft .NET Framework data providers can be installed and registered by system administrators. So we can install and register the data processing extensions and data providers on the report server
    to process and view a report; we can install and register them on the report authoring client to preview a report. But data processing extensions and data providers must be natively compiled for the platform where they are installed.
    For more information about Implementing a Data Processing Extension, please refer to the following document:
    http://msdn.microsoft.com/en-IN/library/ms154655.aspx
    As the issue about how to show Centura Report Builder inside WPF, it related to WPF. It is out of the support boundaries of our forum, I suggestion you post the question in the following forum:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf. It is appropriate and more experts will assist you.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

Maybe you are looking for