SSRS 2005 - Dynamic Query handling.

Hello All,
I need to generate a report based on some dynamic query. I am passing a query string to SQL Server procedure (from .Net UI), this procedure returns dynamic set of columns. These columns and number of columns can vary from query to query. I want to show these
columns on report dynamically.
Please suggest. Thanks in advance.
-Regards
-Kumud Vaish

Hi Kumud,
I don't think it is possible do display the dynamic columns on the report since the columns and number of columns are dynamically.
In a SQL Server Reporting Services report, we need to get the column name and use it on a column of a tablix control if we want to display it on a report. In your scenario, the columns name are dynamic. When reference to a column which not
exist on the dataset, we will get the error
"Report item expressions can only refer to the fields within the current dataset scope or if inside an aggregate, the specified dataset scope."
Thank you for your understanding.
Regards,
Charlie Liao
TechNet Community Support

Similar Messages

  • SSRS 2005 - Dynamically control the width of columns in Matrix report or Hide any column

    Hi All,
    I just want to hide some column without having white space in Matrix report in SSRS 2005. Although I am aware of that perhaps this feature is not available on SSRS 2005. So, I just want to know if we can handle the width of column dynamically(using expressions)
    in matrix report?
    Please help. Thanks in Advance.
    Regards
    Kumud

    Hi Kumud,
    Based on my test, SSRS is not support column dynamically width. It has property “CanGrow” of text box. If we configure the property to True, it will wraps to next line if needed. In SSRS 2008, we can hide some columns without white space. If possible, I
    recommend you update your SSRS 2005 to SSRS 2008.
    There is a similar issue, you can refer to it.
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/9e6043f1-c458-4540-be59-d37b02feab8a/dynamic-column-width-for-a-report?forum=sqlreportingservices
    Alternatively, I recommend you that submit a wish to the Microsoft Connect at
    https://connect.microsoft.com/SQLServer/Feedback. Your feedback is valuable for us to improve our products and increase the level of service provided.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • Query a stored procedure that exec's a dynamic query. Error Linked server indicates object has no columns

    I have a stored procedure that dynamically creates a pivot query.  The procedure works and returns the correct data.  Now I have a requirement to show this data in reporting system that can only pull from a table or view.  Since you can not
    create a dynamic query in a view I tried to do a select from using openquery. 
    Example 'Select * from OpenQuery([MyServername], 'Exec Instance.Schema.StoredProcedure')
    I get the error back "the linked server indicates the object has no columns".  I assume this is because of the first select statement that is stuffing the variable with column names. 
    CODE FROM PROCEDURE
    Alter PROCEDURE [dbo].[Procedure1]
    AS
    BEGIN
    SET NOCOUNT ON
    Declare @cols nvarchar(2000),
      @Tcols nvarchar(2000),
      @Sql nvarchar (max)
    select @cols = stuff ((
          Select distinct '], ['+ModelName + '  ' + CombustorName
           from CombustorFuel cf
           join Model m on cf.modelid = m.modelid
           join Combustors cb on cf.CombustorID = cb.CombustorID
           where cf.CombustorID > 0
           for XML Path('')
          ),1,2,'')+']'
    Set @Tcols = replace(@Cols, ']', '] int')
    --Print @Tcols   
    --Print @Cols
    Set @Sql = 'Select GasLiquid, FuelType, '+ @Cols +'
    from
     Select GasLiquid, FuelType, ModelName+ ''  '' +CombustorName ModelCombustor, CombFuelStatus+''- ''+CombFuelNote CombFuelStatusNote
      from Frames f
      join Family fa on f.Frameid = fa.frameid
      join Model m on fa.FamilyID = m.FamilyID
      join CombustorFuel cf on m.Modelid = cf.modelid
      Join Combustors c on cf.CombustorId = c.CombustorID
      join FuelTypes ft on cf.FuelTypeID = ft.FuelTypeID
      where cf.CombustorFuelID > 0
        and CombustorName <> ''''
     ) up
    Pivot
     (max(CombFuelStatusNote) for ModelCombustor in ('+ @Cols +')) as pvt
    order by FuelType'
    exec (@Sql)

    Then again, a good reporting tool should be able to do dynamic pivot on its own, because dynamic pivoting is a presentation feature.
    SSRS Supports dynamic columns: Displaying Dynamic Columns in SSRS Report
    SQL Reporting Services with Dynamic Column Reports
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014
    Displaying and reading are two very different things.
    #1) SSRS Needs a fixed field list on the input side to know what what to make available in the designer.
    #2) SSRS cant read "exec (@Sql)" out of a proc, even if there is a fixed number of columns (at
    least it can't use it to auto build the field list from the proc)
    I use dynamic SQL in my report procs on a fairly regular basis and I've found it easiest to simply dump
    the results of my dynamic sql into a temp table at the end of the procs and then select from the temp table.
    Basically, Erland is correct. Stop trying to pivot in the query and let SSRS (or whatever reporting software you're using) handle it with a Martix.
    Jason Long

  • What is the best way to create a SSRS 2005 Line Chart Report for a 12 month period?

    I'm looking for advice on how to create a SQL Server 2005 query and line chart report for SSRS 2005.
    I need to display the peak number of patients assigned to a medical practice each month for a 12 month period based on the end-user selecting a
    single month and year.
    I've previously created a report that displays all patients assigned to the practice for any single month but I’m looking for advice on how to
    how to produce a resultset that shows the peak number of patients each month for a 12 month period. I thought about creating a query that returns the peak count for each month (based on my previously created report which displays all patients assigned to the
    practice for any single month) and then use a UNION statement to join all 12 months but I'm sure that isn't the most efficient way to do this. The other challenge with this approach (twelve resultsets combined via a UNION) is that the end-user needs to be
    able to select any month and year for the parameter and the report needs to display the 12 month period based on the month selected (the month selected would be the last month of the 12 month period).
    For the report I’ve previously created that displays all patients assigned to the practice for any single month, the WHERE statement filters the
    resultset on two fields:
    Start Date - The date the patient was assigned to the practice. This field is never null or blank.
    End Date - The date the patient left the practice. This field can be null or blank as active patients assigned to the practice do not have an End Date. When the patient
    leaves the practice, the date the patient left is populated in this field.
    Using these two fields I can return all patients assigned to the practice during Nov 2012 by looking for patients that meet the following criteria:
    start date prior to 11/30/2012 (using the last day of the month selected ensures patients added mid-month would be included)
    AND
    end date is null or blank (indicates the patient is active) OR the end date is between 11/1/2012 -11/30/2012 (returns patients that leave during the month
    selected)
    Regarding the query I need to create for the report that displays the peak count each month for 12 months, I'm looking for advice on
    how to count patients for each month the patient is assigned to the practice if the patient has been assigned for several months (which applies to most patients). Examples are:
    John Doe has a start date of 6/01/2012 and an End Date of 10/07/2012
    Sally Doe has a start date of 8/4/2012 and no End Date (the patient is still active)
    Jimmy Doe has a  start of 7/3/2012 and an End Date of 9/2/2012
    Given these examples how would I include John Doe in the peak monthly count each month for May - October, Sally Doe in the peak monthly count for
    August - December and Jimmy Doe in the peak monthly count for July – Sept if the end-user running the report selected December 2012 as the parameter?
    Given the example above and the fact I'm creating a line chart I think the best way to create this report would be a resultset that looks like
    this:
    Patient Name              
    Months Assigned
    John Doe
    June 2012
    John Doe                     
    July012
    John Doe                     
    Aug 2012
    John Doe                     
    Sept 2012
    John Doe
    Oct 2012
    Sally Doe                     
    Aug 2012
    Sally Doe                     
    Sept 2012
    Sally Doe
    Oct 2012
    Sally Doe                     
    Nov 2012
    Sally Doe
    Dec 2012
    Jimmy Doe                  
    July 2012
    Jimmy Doe
    Aug 2012
    Jimmy Doe
    Sept 2012
    From the resultset above I could create another resultset that would count\group on month and year to return the peak count for each month:
    June 2012 - 1
    July 2012 – 2
    Aug 2012 - 3
    Sept 2012 - 3
    Oct 2012 - 2
    Nov 2012 - 1
    Dec 2012 - 1
    The resultset that displays the peak count for each month would be used to create the line chart (month would be the X axis and the count would
    be the y axis).
    Does this sound like the best approach?
    If so, any advice on how to create the resultset that lists each patient and each month they were assigned to the practice would be greatly appreciated.
    I do not have permissions to create SPs or Functions within the database but I can create temp tables.
    I know how to create the peak monthly count query (derived from the query that lists each patient and month assigned) as well as the line chart.
    Any advice or help is greatly appreciated.

    Thanks for the replies. I reviewed them shortly after they were submitted but I'm also working on other projects at the same time (hence the delayed reply).
    Building a time table and doing a cross join to my original resultset gave me the desired resultset of the months assigned between dates. What I can't figure out now is how to filter months I don't want. 
    Doing a cross  join between my original resultset that had two dates:
    08/27/2010
    10/24/2011
    and a calendar table that has 24 rows (each month for a two year period)
    my new resultset looks like this:
    I need to filter the rows in yellow as the months assigned for stage 3 that started on 8/27/2010 should stop when the patient was assigned to stage 4 on 10/24/2011.
    You'll notice that Jan - Sept 2011 isn't listed for Stage 4 assigned on 10/24/2011 as I included a filter in the WHERE clause that states
    the Months Assigned value must be greater than or equal to the date assigned value.
    Any advice would be appreciated.

  • Want to use the same #TEMP table for multiple datasets in SSRS 2005

    I am using Visual Studio 2005 to create SSRS 2005 reports. The report will consist of two different matrix from two different dataset that will gather data from the same data source. The first dataset is a procedure that inserts data from a query into
    a #temp table and outputs it in the first matrix. I want the second dataset to be a different procedure that references the same #temp table. When the report is pulled then can the #temp table be dropped.

    Try in the Dataset properties.  In the Query tab, under and to the right of "Data source:" click the box with the elipses (...).  In the General tab, toward the bottom, there is a check box beside "Use single transaction".
    Rakesh M J | MCTS,MCITP ( SQL SERVER 2008 )
    Dont forget to mark it as Answered if found useful |
    myspeakonbi

  • Dynamic Query Doubt

    Hi,
    I need to write a Dynamic Query to get the data from the table by using the Input date parameters.
    LIke,
    SELECT* from table where date_start between to_date('12-14-2004','mm-dd-yyyy') AND
    to_date('12-15-2005','mm-dd-yyyy');
    How can i write the above query in dynamic sql as i will get the two dates as input in my procedure
    Help me in this

    Or more preferably use bind variables with the
    EXECUTE IMMEDIATE as, if the query will be called
    many times, the bind variables will prevent hard
    parsing of the statement each time (i.e. it will be
    quicker to execute).blushadow,
    Yes, the execute immediate using bind variables is better/faster than not using bind variables, but your first example outperforms your second one. This is due to the fact that execute immediate really closes all cursors, and in your first example the cursors are kept open (yes, even though you issue a CLOSE cur_test) in the PL/SQL cursor cache.
    SQL> create table i_links
      2  as
      3  select sysdate - l linkdate from (select level l from dual connect by level <= 10000)
      4  /
    Tabel is aangemaakt.
    SQL> exec dbms_stats.gather_table_stats(user,'I_LINKS')
    PL/SQL-procedure is geslaagd.
    SQL> create or replace procedure test1 (start_date in date, end_date in date) as
      2    CURSOR cur_test IS
      3      SELECT count(*)
      4      FROM   i_links
      5      WHERE  linkdate BETWEEN start_date AND end_date;
      6    v_count NUMBER;
      7  begin
      8    OPEN cur_test;
      9    FETCH cur_test INTO v_count;
    10    CLOSE cur_test;
    11    --DBMS_OUTPUT.PUT_LINE('Count: '||v_count);
    12  end;
    13  /
    Procedure is aangemaakt.
    SQL> create or replace procedure test2 (start_date in date, end_date in date) as
      2    v_count NUMBER;
      3  begin
      4    EXECUTE IMMEDIATE 'SELECT count(*) FROM i_links WHERE linkdate BETWEEN :x1 AND :x2' INTO v_count USING start_date, end_date;
      5    --DBMS_OUTPUT.PUT_LINE('Count: '||v_count);
      6  end;
      7  /
    Procedure is aangemaakt.
    SQL> begin
      2    -- warm up
      3    test1(sysdate-365,sysdate);
      4    test2(sysdate-365,sysdate);
      5    -- begin test
      6    runstats_pkg.rs_start;
      7    for i in 1..1000
      8    loop
      9      test1(sysdate-365,sysdate);
    10    end loop;
    11    runstats_pkg.rs_middle;
    12    for i in 1..1000
    13    loop
    14      test2(sysdate-365,sysdate);
    15    end loop;
    16    runstats_pkg.rs_stop(100);
    17  end;
    18  /
    Run1 draaide in 341 hsecs
    Run2 draaide in 348 hsecs
    Run1 draaide in 97,99% van de tijd
    Naam                                                    Run1      Run2  Verschil
    STAT.session cursor cache hits                             0       998       998
    STAT.opened cursors cumulative                             0     1,000     1,000
    STAT.parse count (total)                                   0     1,000     1,000
    LATCH.shared pool                                      1,047     3,043     1,996
    STAT.recursive calls                                   3,001     1,001    -2,000
    LATCH.library cache pin allocation                         8     2,011     2,003
    LATCH.library cache pin 2,048 6,044 3,996
    LATCH.library cache 2,056 6,060 4,004
    Run1 latches totaal versus run2 -- verschil en percentage
          Run1      Run2  Verschil     Pct
        48,522    60,548    12,026  80.14%
    PL/SQL-procedure is geslaagd.Regards,
    Rob.

  • To collect small slices into a secondary, callout pie chart in SSRS 2005

    Hi Guys, 
    There exists a property in pie chart in SSRS-2008 which can consolidate the small slices on pie chart. But I am unable to find the same property in SSRS-2005. 
    Is this property only available in SSRS-2008 ? If yes how can we achieve the same functionality in SSRS-2005 Pie Chart ?
    Regards
    Consolidating Small Slices on a Pie Chart
    Consolidating Small Slices on a Pie Chart
    Consolidating Small Slices on a Pie Chart
    Consolidating Small Slices on a Pie Chart
    Consolidating Small Slices on a Pie Chart

    Hello,
    Based on my research, the CollectedStyle property that collect small slices into one signal slice or a secondary, callout pie chart is available from Reporting Services 2008. So it is not supported in Reporting Services 2005.
    For example, you are using the query below to return the SECTION and DIVISION fields as the chart fields: SELECT SECTION , DIVISION FROM TEMP, and you want to collect small slice COUNT(DIVISION) smaller than 5 as the callout pie chart. To work around this
    issue, we can create two charts on the surface, one as the big and collected slices chart, another one as the secondary, callout pie chart. For more details, please refer to the following steps:
    We can use the query with some conditions like below to return the fields for the main chart:
    SELECT CASE
       WHEN COUNT(DIVISION) <= 5 THEN 'Other'
       WHEN COUNT(DIVISION) >5 THEN SECTION
       END  AS SECTION, COUNT(DIVISION) AS DIVISION
     FROM TEMP
    GROUP BY SECTION, DIVISION
    We can use the query like below to return the fields for the callout pie chart:
    SELECT CASE
          WHEN COUNT(DIVISION) <= 5 THEN SECTION
       END  AS SECTION, CASE
          WHEN COUNT(DIVISION) <=5 THEN COUNT( DIVISION)
       END  AS DIVISION
     FROM TEMP
    GROUP BY SECTION, DIVISION
    The following screenshot is for your reference:
    If there are any other questions, please feel free to ask.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Sending a dynamic query to DB adapter

    Hi,
    I am using jdeveloper 10.1.3.4. As per the requirements, I am supposed to have only one DB adapter which will handle all the operations on the database tables. The SQL is created at the runtime depending on the input. Is there any option for DB adapter where I can pass this dynamic query?
    Thanks
    Taru

    Taru,
    I assume you're talking about the ESB/SOA Suite DB adapter - in which case, the SOA Suite forum would probably yield you better results.
    John

  • Passing dynamic query to DB adapter

    Hi,
    I am using jdeveloper 10.1.3.4 for configuring a BPEL flow. As per the requirements, I am supposed to have only one DB adapter which will handle all the operations on the database tables. The SQL is created at the runtime depending on the input. Is there any option for DB adapter where I can pass this dynamic query? Is there another way to implement this, if not this way?
    Thanks
    Taru

    Taru,
    I assume you're talking about the ESB/SOA Suite DB adapter - in which case, the SOA Suite forum would probably yield you better results.
    John

  • Building a dynamic query

    I have a need to build a truly dynamic query, that would be able to take online form input and create a query that would handle data requests like, How many employees earn less than #some salary, have a masters degree, and speak chinese.  or show me all the employees in org A that are vets.
    A true ad hoc query tool. 
    the back end is oracle 11g, the database  contains about 8 or 9 tables all total there about 500 records that will be searched. we are running CF7.
    I just started kicking this around today so I am open for Ideas.  add filters in the where clause, i got that,   start with  1=1 and use conditional statements to add filters as necessary.  setting up the Select and From statements, need help there.
    Since this is a small db, I thout about, but scrapped, making a super-view to query from.
    your thoughts and suggestions would be greatly appreciated.
    thanks
    jb

    What about something like this:
    1) Determine what tables are going to be involved (visual GUI/drag & drop interface for the users?)
    2) Have a table that defines the relationship between the other tables in your database - once the table selection is made by the user, you can query this table to determine what columns you are going to join on.  Obviously this won't allow you complete customization but it would work for the scenarios you describe.
    3) Use your database system properties to retrieve the field names from your included tables
    4) Allow your users to add "filters" based on the fields retrieved in (3)
    e.g. You could use an interface to allow users to add a filter, where you display a list of fields from your tables and allow them to apply a simple filter to them - keep it simple (=, !=, >, <)
    for bonus points, you could limit the options based on the field type (checkboxes for bit fields, etc)
    sanitize the user input - find a SQL-safe reg exp script to handle any unwanted characters (I'm looking at you apostrophe).
    5) Don't try an support aggregates if you don't need to - users can load the results into excel and manipulate them to their hearts content.
    6) Build your SQL using the selections made by the user.  Import all records from your joined tables.  Use the table from (2) to determine which fields they join on.  and build your where clause using the filters the user created in steap (4).  Again, be sure anything not explicitly set by the system is sanitized prior to making its way into the SQL.
    7) Execute() your SQL inside a CF query.  Expect pretty poor performance, since most SQL databases won't optimize a query plan from a dynamic SQL evaluation.
    You could build this as a multi-step wizard in CF, but it would be pretty flashy as a jQuery/web service based application.

  • Partially Bold Text in SSRS 2005 using Expression ?

    Hi,
    I am using SSRS 2005.
    I have one requirment. I need to Partially Bold some part of Text in column.
    Below is the Example.
    Name < - -- Column in SSRS 2005 Report.
    This column contains combination of Last Name and First Name. All Database record contains Last name , while in some record our requirment is to append First Name with that.
    That is i aleady handled using Nested IIF Expression.
    Now, i want to display appended First Name in normal while all Last Name whihc is Database Field in BOLD Font.
    How is it possible ?

    Hi
    I have just saw a possible solution (well done Hentie Stassen!)
    The best solution of course is to upgrade to SQL 2008 reporting services.
    But, if you are stuck with SQL 2005, try the following:
    We know that a possible solution is to have 2 textboxes.  One for name, one for surname.  Then make the surname bold.  This works, but spacing is a big problem as we saw in other examples on this thread.  Here is the solution for the
    spacing problem:
    The idea is to have 1 textbox for the name, with lots of surname textboxes at different positions and only have 1 of these surname textboxes visible. 
    More detail:
    1. The left-most textbox is the Name field.
    2. Then have 10 or more Surname textboxes, with Bold and displaying the Surname field.  All surnames text boxes overlapping each other, but each one starting about 1cm to the right of the previous one.  The first Surname textbox starts about 1cm
    to the right of the leftmost point of the Name textbox, overlapping most of it.
    3. Now set the visibility property of each of the "Surname" textboxes.  All will be hidden by default.  Set the visibility of the 1st "surname" to true only if the lenth of the name field is less than 2.  Set the visibility
    of the 2nd "surname" to true only if the length of name =2, etc.
    Have a happy day
    Andre Maakal

  • Try catch implementation in dynamic query

    I am fetching values by dynamic selection  (select a,b,..from (var)...) .
    Eveytime if I am selecting garbage value of var it will throw dump . Can u tell me how we implement try catch method / exception handling method so that I can avoid dump in dynamic query
    Appropriate answer will rewarded with points  that is for sure .

    Here is the usage  of th try statements ...
    PARAMETERS number TYPE i.
    DATA: result TYPE p LENGTH 8 DECIMALS 2,
          oref   TYPE REF TO cx_root,
          text   TYPE string.
    TRY.
        IF ABS( number ) > 100.
          RAISE EXCEPTION TYPE cx_demo_abs_too_large.
        ENDIF.
        PERFORM calculation USING    number
                          CHANGING result
                                   text.
      CATCH cx_sy_arithmetic_error INTO oref.
        text = oref->get_text( ).
      CATCH cx_root INTO oref.
        text = oref->get_text( ).
    ENDTRY.
    IF NOT text IS INITIAL.
      WRITE / text.
    ENDIF.
    WRITE: / 'Final result:', result.
    FORM calculation USING    p_number LIKE number
                     CHANGING p_result LIKE result
                              p_text   LIKE text
                              RAISING  cx_sy_arithmetic_error.
      DATA l_oref TYPE REF TO cx_root.
      TRY.
          p_result =  1 / p_number.
          WRITE: / 'Result of division:', p_result.
          p_result = SQRT( p_number ).
          WRITE: / 'Result of square root:', p_result.
        CATCH cx_sy_zerodivide INTO l_oref.
          p_text = l_oref->get_text( ).
        CLEANUP.
          CLEAR p_result.
      ENDTRY.
    ENDFORM.
    <b>please see this  link for detailed  explaination  of the TRY & ENDTRY  ...</b>
    <a href="http://">http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm</a>
    reward  points if it is usefull......
    Girish

  • Dynamic Query Data issue...Apex Charts

    Database version and APEX version are in the tags...11g  and4.1.2
      I have data in this format
    NODE_NAME
    REPORT_DATE
    STORAGE_AMOUNT_ALLOC
    Anole
    01/01/2013
    3175
    Fiji
    01/01/2013
    0
    Anole
    02/01/2013
    3175
    Fiji
    02/01/2013
    0
    Anole
    04/01/2013
    3276
    Fiji
    04/01/2013
    0
    Anole
    05/01/2013
    3276
    Fiji
    05/01/2013
    0
    Anole
    06/01/2013
    3276
    Fiji
    06/01/2013
    0
    I've build a Dynamic query which returns:
    SELECT NULL LINK,report_date DATIME,decode(NODE_NAME,'Anole',STORAGE_AMOUNT_ALLOC)"Anole",decode(NODE_NAME,'Fiji',STORAGE_AMOUNT_ALLOC)"Fiji" FROM STORAGE_REPORTS WHERE report_date between to_date('01-JAN-2013','DD-MON-YYYY') and to_date('01-JUN-2013','DD-MON-YYYY') and (INSTR(':Anole:Fiji:', ':'||NODE_NAME||':') > 0) ORDER BY report_date ASC
    The resultant data is
    LINK
    DATIME
    Anole
    Fiji
    01/01/2013
    3175
    01/01/2013
    0
    02/01/2013
    3175
    02/01/2013
    0
    04/01/2013
    3276
    04/01/2013
    0
    05/01/2013
    0
    05/01/2013
    3276
    06/01/2013
    3276
    06/01/2013
    0
    When I put the above query to the chart it give me accurate series with one..however when I add a second NODE to the query it completly hacks the chart. I have a feeling this is because I have repeating dates and it doesn' know how to handle this. So I'm wondering how I get rid of the repeating dates. and make them all one row with columns for each series.
    Thanks
    Rob

    apex version?  database version?
    if you're on 11g, it sounds like you want the PIVOT command.
    you should also post a simple CREATE TABLE and a few INSERT statements so others can test.
    select null link
      ,report_date as datime
      ,"Anole", "Fiji"
    from ( select REPORT_DATE, NODE_NAME, STORAGE_AMOUNT_ALLOC
      from STORAGE_REPORTS
    PIVOT (
      sum( storage_amount_alloc )
      for (node_name)
      in ( 'Anole' "Anole", 'Fiji' "Fiji" ) -- rename columns here
    where report_date between to_date('01-JAN-2013','DD-MON-YYYY') and to_date('01-JUN-2013','DD-MON-YYYY')
    order by report_date asc

  • Dynamic query exception

    How to handle dynamic query exception
    in my dynamic query say if i pass the wrong table name it is showing some errors instead i would like to use my own error statement as output
    eg:
    mytable :test_table
    declare mytable varchar2 :=test_table1234 --(which is not present in DB)
    begin
    execute immediate ('select * from '|| mytable);
    -- Error handling here
    end;

    I wouldn't use WHEN OTHERS, not unless you want to be fired for breaking coding standards. If you insist, at least follow it with RAISE.
    Here is a an exposition of the problem, http://www.orafaq.com/wiki/WHEN_OTHERS and another http://tkyte.blogspot.co.uk/2008/06/when-others-then-null-redux.html

  • Poor Processing Performance after Migration from SSRS 2005 to SSRS 2014

    Hello all,
    a customer is moving from SQL Server 2005 to SQL Server 2014 (clean install on a new machine). There are a lot of reports against an Analysis Services database. I have converted and deployed the reports. Most of them are showing a significant performance
    improvement, but some of them became very slow.
    Analyzing the report server's execution log I have discovered that the rendering time has increased very much (see picture for a specific report below - above the blue line is SSRS 2005 on an older machine, below is SSRS 2014 on a new machine).
    Do you have any hints what I can do?
    Thanks in advance and best regards,
    Gerald

    Thank you for your reply. Cumulative Update 4 has already been installed (I have just compared the installed version number with the list on
    sqlserverbuilds.blogspot.com).
    My first suspicion was also a rdl conversion problem. But as even reports with a blank page where showing this rendering performance problem I began to look at the datasets (although they are executed very fast according to the report server's
    execution log view).
    All MDX queries have been designed using the
    Analysis Services MDX Query Designer. The option for not showing empty cells is activated to supress empty rows. But this option always applies to both axes (when usings the query designer). Thus columns for measures with null values in all rows are omitted
    from the result set. When rendering a report the rsMissingFieldInDataSet-Error is shown, but in SSRS 2005 and also in the Data Tools for SQL Server 2014 this has no further impact.
    But SSRS 2014 is performing very bad in this case. If I remove the NON EMPTY clause for the columns (which only works when switching to the text query builder, so the customer is not able to modify the queries anymore) the report performance will be as expected.
    So far there're only two reports left where this does not solve the performance issue.
    During testing I have also observered the BIDS - SQL 2008 R2 Warnings not clearing-bug which can be reproduced by everyone except
    Microsoft ;)
    Regards,
    Gerald

Maybe you are looking for

  • Unable to launch application from my machine:Bad MIME Type

    Hi, The following error message was printed when I tried to access the SwingSet2 demo from the Java Web Start site. An error occurred while launching/running the application. Title: SwingSet2 Vendor: Sun Microsystems, Inc. Category: Download Error Ba

  • Needed help to improve the performance of a select query?

    Hi, I have been preparing a report which involves data to be fetched from 4 to 5 different tables and calculation has to performed on some columns also, i planned to write a single cursor to populate 1 temp table.i have used INLINE VIEW,EXISTS more f

  • Why always failure at 45% of install of Base System Part 1?

    Ok I have had Panther run on my iMac several times only to have it screw up and destroy itself hence reinstallation. However no matter what configuration I pick of Panther, It always either freezes up or kernel panics at precisely 45% of installation

  • Dynamic Date Calculation

    Hi all, Currently, i need to run a background PO report daily. As i only want today's PO data everytime the background job runs, i set the PO date dynamically using dynamic date calculation choosing current date, save it as a variant then schedule da

  • How to authenticate interactively instead of using XSQLConfig.xml?

    Is it possible to authenticate to Oracle through an HTML form and use this connection in XSQL instead of having to specify the "connection" attribute of xsql:* elements? Is there any way to avoid having the cleartext passwords in XSQLConfig.xml? Than