Stored procedure in reports

hi all,
Have any one used stored procedure to populate data for reports
also publish a sample code which illustrates the above said issue

thank u chida,
nice reply it seems that the report triggers are of much useful.
please reply me about the usage of the report triggers
i can know about the utility and criticality of the triggers available in reports, also it will be useful for me in interview point-of-view in future.
expecting a reply

Similar Messages

  • Calling a stored procedure from Reports

    I am trying to call a stored procedure using oracle reports in the afterparameter code. My code is:
    v_ain := sp_get_ain(:P_session_id);
    Can someone help me out by telling what is wrong. I keep getting an error stating that sp_get_ain needs to be declared.?!

    I am creating a function and a stored procedure and calling them
    in afterparameter report trigger.
    -------------------Create function ----------------
    create or replace function get_name( emp_id number) return varchar2 is
    v_name varchar2(20);
    begin
    select name into v_name
    from sample_table
    where employ_id = emp_id ;
    return(v_name); ---------This is the way to return value from function.
    exception
    when no_data_found then
    return('Name not found.');
    when others then
    return('Other error found.');
    end ;
    ==================================================================================
    ------------------------Create procedure ------------------------------------
    create or replace procedure get_name( emp_id number, return_name out varchar2) is
    v_name varchar2(20);
    begin
    select name into v_name
    from sample_table
    where employ_id = emp_id ;
    return_name := v_name ; --Assign out parameter value from procedure.
    exception
    when no_data_found then
    return_name := 'Name not found.';
    when others then
    return_name := 'Other error found.';
    end ;
    ============================================================================
    -----------------Call function and procedure from report ---------------------
    In formula column or any report trigger you can use this code.
    v_function_return_name varchar2(20);
    v_procedure_return_name varchar2(20);
    v_employ_id number(10);
    begin
    v_employ_id := 101 ;
    v_function_return_name := get_name(v_employ_id ); --- call function
    get_name(v_employ_id , v_procedure_return_name ); -- call procedure
    end;
    Here v_function_return_name has same value as v_procedure_return_name,
    these are the values returned from function and procedure.
    --Anita

  • Calling Stored Procedure in Reports

    Hi,
    What is the exact syntax to call a stored procedure?
    I have a stored procedure called 'proc_ccipt'
    I created a public synonym for it and I am trying to call it from 'Before Report' event of a report:
    Execute proc_ccipt;
    and I get the compilation error "Encountered the symbol 'proc_ccipt' ....".
    This procedure inserts rows into a temp table.
    Thanks
    Catherine
    null

    hello catherine
    in pl/sql block you don't have to use execute before procedure name. so in your case it is simply proc_ccipt;
    hope this helps

  • Oracle Stored Procedure in Reports

    Hi ,
    How can i call oracle stored procedure in Oracle Reports. The procedure takes an object type variable and as out parameter.
    Thanks,
    Ashish Goel

    Hi,
    Thanks for the help but i have a stored procedure which ia already built in my oracle database.
    The signature of the proceure are as follows:
    PRC_AGGR_DETAILS (P_BP_Id IN NUMBER,
    P_Level IN VARCHAR2,
    P_AggSummary OUT ObjAggSummary,
    P_err_msg OUT VARCHAR2,
    P_err_code OUT NUMBER);
    where
    P_AggSummary is an object (user defined)
    CREATE OR REPLACE Type ObjAggSummary as OBJECT (BP_ID NUMBER(12),
    Detail_Level VARCHAR2 (7),
    Delta_Limit_Cash NUMBER(20,3),
    Delta_Limit_Cont NUMBER(20,3),
    Delta_Limit_Margin NUMBER(20,3),
    Pndg_Limit_Cash NUMBER(20,3),
    Pndg_Limit_Cont NUMBER(20,3),
    Pndg_Limit_Margin NUMBER(20,3),
    Net_Limit_Cash NUMBER(20,3),
    Net_Limit_Cont NUMBER(20,3),
    Net_Limit_Margin NUMBER(20,3),
    CDS NUMBER(20,3),
    CONSTRUCTOR FUNCTION ObjAggSummary RETURN SELF AS RESULT
    Now i need to display all these values in the object ObjAggSummary in my different report as different fields.

  • Multiple stored procedures on report

    I linked two stored procedures on Crystal Report using primary keys but have been having login issues when I migrated from Development to Test environment. I'm NOT using SubReports.
    I want to know if it is even possible to use multiple stored procedures on Crystal Report without using SubReports? I'm using Crystal Reports 10 and SQL Server 2008

    2) CR 10 does not support MS SQL 2008. Check the supported platforms documentation. I Recommend upgrading to CR 2008.
    -- Crystal Reports using single stored procedure and sub reports worked fine with SQL 2008
    That is kind of like saying; my Ferrari was not designed for dirt roads. And it was pretty good on the dirt back lane. But when I went on a mountain logging road,  it broke.
    Anyhow. From your description it also looks like this works for you in the designer ("development" environment), but not once you get it into Enterprise. If that is the case, post your query to the [Business Objects Enterprise Administration|BI Platform; forum, see what they say.
    Ludek

  • Calling stored procedure from Reports Data wizard

    What is the exact syntax for entering a stored proc name in the Data wizard, I have created a TEST stored proc which all it does is a simple select statment but the Data wizard complaints that WRONG # of parameter when in fact TEST does NOT take any params. Any ideas?

    I am using Reports 9i & use JDBS query. When it gets to the section that says enter SQL or Stored proc, I enter a simple TEST proc which takes no params & get error msg as explained before ... I don't see any info in the Reports manual as to how to call a proc ... where would I find that info?
    Thx.

  • Crystal Report Source is MS SQL Stored Procedure Causes Login Popup

    My environment is this:  Visual Studio 2010 with CRforVS_13_0_9 installed.  MS SQL Server is source for all report data.  I use three different databases for all my reports.
    I have a number of working CR reports that work fine in IDE and at runtime.  However, one report works in IDE report designer Main Report Preview but does not work at runtime.  Instead, it pops up the Database Login dialog box.  This particular report is the only one that I have that uses a Stored Procedure for report source data.  The following code is used for all reports.  Can someone please help me to identify what is causing this anomaly?
         ' _Options contains parameter name and value pairs, if any
         Dim oReport As New ReportDocument()
         Dim FullReportName = "MA_CustomerUsage"
         oReport.Load(FullReportName, OpenReportMethod.OpenReportByDefault)
         DoCRLogin(oReport)
         If _Options.ParameterList IsNot Nothing Then ImplementCRParameters(oReport)
         With CrystalReportViewer
              .SelectionFormula = _SelectionFormula
              .ReportSource = oReport
              .Zoom(zoomPageWidth)
              .ShowParameterPanelButton = False
              .ToolPanelView = ToolPanelViewType.None
         End With
         Private Sub DoCRLogin(ByVal oRpt As ReportDocument)
                Dim oCRDb As Database = oRpt.Database
                Dim oCRTables As Tables = oCRDb.Tables
                Dim oCRTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
                Dim DatabaseName = oCRTables(0).LogOnInfo.ConnectionInfo.DatabaseName
                Dim oCRConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo() _
                    With {.DatabaseName = ScanInvenConStrSetting("Initial Catalog=", DatabaseName),
                          .ServerName = ScanInvenConStrSetting("Data Source=", DatabaseName),
                          .IntegratedSecurity = True}
                For Each oCRTable As Table In oCRTables
                    oCRConnectionInfo.DatabaseName = oCRTable.LogOnInfo.ConnectionInfo.DatabaseName
                    oCRTableLogonInfo = oCRTable.LogOnInfo
                    oCRTableLogonInfo.ConnectionInfo = oCRConnectionInfo
                    oCRTable.ApplyLogOnInfo(oCRTableLogonInfo)
                Next
         End Sub
         Private Sub ImplementCRParameters(ByRef oReport As ReportDocument)
                Dim oparamFields = New ParameterValues
                Dim oFieldDefs = oReport.DataDefinition.ParameterFields
                For Each CRParameter In _Options.ParameterList
                    Dim oFieldDef = oFieldDefs("@" & CRParameter.Name)
                    Dim oDiscrete As New ParameterDiscreteValue()
                    oDiscrete.Value = CRParameter.Value.ToString
                    oparamFields.Add(oDiscrete)
                    oFieldDef.ApplyCurrentValues(oparamFields)
                Next
         End Sub
         Private Function ScanInvenConStrSetting(ByVal Src As String, ByVal DBName As String) As String
                Dim MyDB As String = String.Empty
                Select Case DBName.ToUpper
                    Case "Database1".ToUpper
                        MyDB = Global.My.Settings.Database1ConnectionString
                    Case "Database2".ToUpper
                        MyDB = Global.My.Settings.DatabaseConnectionString
                    Case "Database3".ToUpper
                        MyDB = Global.My.Settings.Database3ConnectionString
                End Select
                Dim ndx1 As Integer = InStr(MyDB, Src, CompareMethod.Text) + Src.Length
                Dim ndx2 As Integer = InStr(ndx1, MyDB, ";", CompareMethod.Text)
                If ndx2 = 0 Then ndx2 = MyDB.Length
                ScanInvenConStrSetting = Mid(MyDB, ndx1, ndx2 - ndx1)
         End Function

    Check what else is different with the report:
    1) Connection type (ODBC vs. OLEDB, vs. Native, etc)
    2) Check for subreports
    3) Check that the report uses the SQL Native 10 Driver
    Enable the report options "Verify on 1st refresh" and "Verify stored procedure on 1st refresh".
    Comment out the db logon code as well as the parameter code and let the report prompt. Does that work?
    If it does, add the db logon code but leave the param code commented out. Does that work?
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

  • Ssrs 2008 r2 report dataset call a stored procedure

    I am modifying an existing SSRS 2008 r2 report. In a dataset that already exists within the ssrs 2008 r2 report I need execute
    a stored procedure called StudentData and pass 3 parameter values to the stored procedure. The stored procedure will then return 5 values that are now needed for the modified ssrs report. My problem is I do not know how to have the dataset call the stored procedure
    with the 3 parameter values and pass back the 5 different unique data values that I am looking for.
    The basic dataset is the following:
    SELECT  SchoolNumber,
            SchoolName,
            StudentNumber,      
     from [Trans].[dbo].[Student]
     order by SchoolNumber,
              SchoolName,
              StudentNumber
    I basically want to pass the 3 parameters of SchoolNumber, SchoolName, and StudentNumber to the
    stored procedure called StudentData from the data I obtain from the [Trans].[dbo].[Student]. The 3 parameter values will be obtained from the sql listed above.
    The  columns that I need from the stored procedure called  StudentData will return the following data columns
    that I need for the report: StudnentName, StudentAddress, Studentbirthdate, StudentPhoneNumber, GuardianName.
    Thus can you show me how to setup the sql to meet this requirement I have?

    Hi wendy,
    After testing the issue in my local environment, we can refer to the following steps to achieve your requirement:
    Create three multiple parameters named SchoolNumber, SchoolName and StudentNumber in the report. Those available values from the basic dataset SchoolNumber, SchoolName and StudentNumber fields.
    If you want to pass multiple values parameter to stored procedure, we should create a function as below to the database:
    CREATE FUNCTION SplitParameterValues (@InputString NVARCHAR(max), @SplitChar VARCHAR(5))
    RETURNS @ValuesList TABLE
    param NVARCHAR(255)
    AS
    BEGIN
    DECLARE @ListValue NVARCHAR(max)
    SET @InputString = @InputString + @SplitChar
    WHILE @InputString!= @SplitChar
    BEGIN
    SELECT @ListValue = SUBSTRING(@InputString , 1, (CHARINDEX(@SplitChar, @InputString)-1))
    IF (CHARINDEX(@SplitChar, @InputString) + len(@SplitChar))>(LEN(@InputString))
    BEGIN
    SET @InputString=@SplitChar
    END
    ELSE
    BEGIN
    SELECT @InputString = SUBSTRING(@InputString, (CHARINDEX(@SplitChar, @InputString) + len(@SplitChar)) , LEN(@InputString)-(CHARINDEX(@SplitChar, @InputString)+ len(@SplitChar)-1) )
    END
    INSERT INTO @ValuesList VALUES( @ListValue)
    END
    RETURN
    END
    Use the query below to create a stored procedure, then use it to create a dataset to return 5 values:
    create proc proc_test(@SchoolNumber nvarchar(50),@SchoolName nvarchar(50),@StudentNumber nvarchar(50))
    as
    begin
    select StudnentName, StudentAddress, Studentbirthdate, StudentPhoneNumber, GuardianName
    from table7 where SchoolNumber in (SELECT * FROM SplitParameterValues (@SchoolNumber,','))  and SchoolName in(SELECT * FROM SplitParameterValues (@SchoolName,','))  and StudentNumber in (SELECT * FROM SplitParameterValues (@StudentNumber,','))
    end
    Right-click the new dataset to modify the parameter value in the Parameters pane as below:
    =join(Parameters!SchoolNumber.Value,",")
    =join(Parameters!SchoolName.Value,",")
    =join(Parameters!StudentNumber.Value,",")
    For more details about pass multi-value to stored procedure, please see:
    http://munishbansal.wordpress.com/2008/12/29/passing-multi-value-parameter-in-stored-procedure-ssrs-report/
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click
    here.
    Katherine Xiong
    TechNet Community Support

  • Null pointer in setTableLocation for a report based on a stored procedure

    im using the crjavahelper class and setTableLocation to change the datasource of a stored procedure based report and its throwing a null pointer exception somewhere in the sdk.  This is happening with sqljdbc4.jar and sql2005 and jdk 1.6.
    Jan 20, 2010 12:43:37 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.NullPointerException
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.do(SourceFile:4605)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:621)
         at com.crystaldecisions.sdk.occa.report.application.b0.if(SourceFile:75)
         at com.crystaldecisions.sdk.occa.report.application.b0.b(SourceFile:106)
         at com.crystaldecisions.sdk.occa.report.application.bb.int(SourceFile:96)
         at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.performDo(SourceFile:151)
         at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.a(SourceFile:106)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:2159)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:543)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:3898)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.setTableLocation(SourceFile:2906)
         at com.businessobjects.samples.CRJavaHelper.changeDataSource(CRJavaHelper.java:191)
         at org.apache.jsp.index_jsp._jspService(index_jsp.java:114)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    any ideas? I tried using the jtds driver and it doesnt throw the exception but it doesnt return any data either, ive never gotten a stored procedure based report to work with it.
    Jeremy

    Check out this forum post:
    Problem using Null as a parameter with a stored procedure

  • How to use stored procedure in crystal report for eclipse

    Hi;
    I am working on crystal report for eclipse 2.0 and  trying to use stored procedure in report .It is created from Oracle but it is not showing any dependencies
    CREATE OR REPLACE procedure ACT_DB.getCostTransferDetails
            p_In_Contract_ID         varchar2 DEFAULT  '*',
            p_In_Status_ID           varchar2 DEFAULT  '*',
            p_In_COST_TRAN_DATE      varchar2 DEFAULT  '*',
            p_In_DEPT_ID             varchar2 DEFAULT  '*',
            p_In_PROJECT_ID          varchar2 DEFAULT  '*',
            p_In_EMPLOYEE_ID         varchar2 DEFAULT  '*',
            p_Out_CostTransfer_Cusor OUT COST_TRANSFER_PACKAGE.COST_TRANSFER_TYPE
    AS
    BEGIN    
            OPEN p_Out_CostTransfer_Cusor FOR
            SELECT
                header.cost_tran_id,
                header.cost_tran_date,
                header.total_credit_amount,
                header.total_debit_amount,
                header.transfer_status,
                header.updated_by,
                header.added_by,
                header.trf_over_ninety_days,
                header.business_unit_id,
                header.equip_approval,
                header.batch_desc,
                details.opr_unit_id,
                status.status_id,
                details.fund_code_id,
                details.prgm_code_id,
                details.class_id,
                details.activity_id,
                details.product_id,
                details.status_id,
                details.transaction_amount,
                details.jrnl_date,
                details.adjust_prcnt,
                details.adjust_amnt,
                details.details_equip_approval,
                details.detail_desc,
                details.account_id,
                details.project_id,
                details.dept_id,
                details.contract_id,
                details.reason_code_id,
                details.jrnl_id,
                employee.f_name,
                employee.l_name,
                employee.employee_id,
                project.project_id,
                project.project_status,
                --header.transfer_status,
                contracts.contract_desc 
              FROM header, details, status, employee, department, project, contracts
             WHERE     (header.cost_tran_id = details.cost_tran_id)
                    AND (header.cost_tran_date = details.cost_tran_date)
                    AND (header.transfer_status = status.status_id)
                    AND (department.dept_id = details.dept_id)
                    AND (department.dept_id = employee.dept_id)
                    AND (project.project_id = details.project_id)
                    AND (contracts.contract_id = details.contract_id)
                    AND (details.Contract_ID = p_In_Contract_ID OR p_In_Contract_ID ='*' )
                    AND (header.TRANSFER_STATUS = p_In_Status_ID OR p_In_Status_ID ='*' )
                    AND (TO_CHAR(details.COST_TRAN_DATE, 'MM/DD/YYYY') = p_In_COST_TRAN_DATE OR p_In_COST_TRAN_DATE ='*' )
                    AND (details.DEPT_ID  = p_In_DEPT_ID  OR p_In_DEPT_ID  ='*' )
                    AND (details.PROJECT_ID  = p_In_PROJECT_ID  OR p_In_PROJECT_ID  ='*' )
                    AND (header.ADDED_BY  = p_In_EMPLOYEE_ID  OR '*'=p_In_EMPLOYEE_ID  )
    Can any another way to make procedure
    Thanx
    Regards ,
    Amol

    Hi Amol,
    Are you able to execute your stored procedure from oracle?.
    - If "Yes" then use  the Crystal Report XIR2 Designer to create the report.
    - Import this report in the Crystal Report For Eclipse Workbench.
    - The latest version for Crystal Report For Eclipse is SP1.
    Please let me know the results.
    Thanks,
    Neeraj

  • How run stored procedure in Crystal report?

    I have table from query in report, but first I need to run stored procedure in report.
    How I need to do it?

    previous post not correct
      this is correct
    When I need to run my report
    1) I need to run storeed procedure ( the stored procedure will update some tables)
    I just used Add Command and added stored procedure in Database Fields, but I think the procedure doesn't work in report. Maybe I need add new commant and write there:
    exec ProcedureName par1 par2
    or
    exec ProcedureName (par1={?parameter1} par2={?parameter2})
    It's doesn't work. What I need to do?
    2) I use some query in report
    ex.
    select t1.col1, t2.col2, t6.col3 t1.col7 t4.col1
    from t1, t2, t6, t4, r4, ju, hh
    where hh.col11={?parameter1}
    and ju.col3=6
    and r4.col3={?parameter2}
    group by .....
    order by ......
    How I need to create me report? What I need to do first?
    If parameter in stored procedure par1={?parameter1} in query
    and par2={?parameter2}

  • Report with stored procedures is unable to run in infoview.

    I developed report for my current employer using stored procedures and saved it to Enterprise environment. When running this report I am getting following Error in Infoview:
    Error in File ~tmp26285c856bf1180.rpt: Failed to retrieve data from the database. Details: [Database Vendor Code: -674 ]
    I can run my same report in Crystal Reports. Previous developer was using data source tables instead of stored procedures and report with tables were running successfully in infoview. What should I need to do in order to recognise my stored procedures in Infoview.
    We use informix databases.
    Regards,
    Rashid Khan

    The above issue have been resolved the issue. The problem was our BO administrator changed the Database server on CMC and my report in infoview was failing because of my stored procedure was not found on new database.

  • How to rename stored procedure on existing report

    I've got several reports that are based on stored procedures starting with the prefix qRpw.  I needed to change the name only of these stored procedures. The actual code within and all the data that the report is bound to stays the same.
    so say the stored procedure the report is tied to is qRpwStoredProc - I need to change the name to qRpStoredProc
    How can I simply change the stored procedure's name without having to start over with the report? 
    TIA
    Harry

    In set datasource Highlight SP in top pane, find the new SP in the lower pane and high light then click update.
    You will need to rename SP in Database expert as it will retain alias of original name.
    Ian

  • Crystal reports for eclipse ver 2 with oracle stored procedures

    Does Crystal Reports for Eclipse version 2 support Oracle Stored Procedures.
    I have been struggling to get this to work for the last 1 week.
    Any help would be appreciated.
    Regards
    Avinash Tauro

    Thank you for your reply.
    Does this mean that oracle stored procedures cannot be used at all in the J2EE environment. As even if I create the report using Crystal Reports 2008, I am unable to get it to work.
    However It works great on .NET.
    Since I can't use stored procedures, I've just copied the query to a bean and am executing it using jdbc. Also I am using the POJO method to link to the report.
    This is working fine, except for the maintainance headache, as I have about 25 stored procedures for reporting, with each having a pretty complex query.
    I guess I will convert all the stored procedures to front end based query mangement and use the POJO method to connect Crystal Reports.
    Any suggestions / recommendations would be helpful.
    Regards
    Avinash Tauro

  • SSRS. Not passing fields/parameters to report when stored procedure keeps parameters inside IF statement

    So what I mean:
    I have stored procedure like this:
    CREATE PROCEDURE sp_Example
    @param1 NVARCHAR(20) = '',
    @param2 DATE = ''
    AS
    BEGIN
    IF (SELECT COUNT(*) FROM Table1 WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')) > 2
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table2
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    IF (SELECT COUNT(*) FROM Table1 WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')) < 2
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table3
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    END
    So in stored procedure are some input parameters and they are passed into IF statement.
    If I use this stored procedure as report's dataset (Microsoft Visual Studio 2013) in following:
    Add
    Dataset > Query
    Type: Stored Procedure > sp_Example It
    do NOT get any fields, but get parameters
    If I use this stored procedure in following:
    Add
    Dataset > Query
    Type: Text > EXECUTE
    sp_Example It get all required fields, but do NOT get parameters
    Of course If I add manually parameters or fields It not working.
    If I change IF statement
    in stored procedure something like:
    IF (1 < 3)
    BEGIN
    SELECT Name, Date, Price, Etc
    FROM Table3
    WHERE (Name = @param1 OR @param1 = '') AND (StartDate = @param2 OR @param2 = '')
    END
    It normally working in report (getting all fields and parameters). So problem is that I pass parameters to IF statement.
    Have you any ideas how to pass parameters to IF statement
    and get It correctly working on report?

    Hi Stanisolvas,
    Per my understanding that you are experending some issue when using the stored procedure to create the dataset, you can't get the fields to display under the dataset, right?
    I have tested on my local environment with the same script as your and can't reproduce the issue, Please try to check and provide more details information according to below points:
    What do you mean of not get any fields, Is that mean no table header along with the value will display? If you got any error message, please provide it.
    Did you use any temp table in the stored procedure, if so, the issue can be caused by the temp table you are using, please don't use temp table in it which will cause no fields display.
    If you use the second method to execute the procedure, please check to make sure you have added the script like below to make the parameters display in the report:
    exec sp_Example @Param1=@Param1,@Param2=@Param2
    Please execute the stored procedure in the SQL Server Management Studio like below to see if the stored procedure will works fine:
    exec sp_Example @Param1='Test1',@Param2='2014-10-15'
    If this work fine in the management studio, please try to create an new report to re-add this procedure.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

Maybe you are looking for