Showing posts with label dataset. Show all posts
Showing posts with label dataset. Show all posts

Friday, March 23, 2012

Problem with accessing stored procedure in the report

Hi,

I am new to Sql Server 2005 Reporitng Services. I created a report in BI and used stored procedure as a dataset. When I run the report in preview mode it works fine and when I run it in report server/report manager, I am getting the following error:

  • An error has occurred during report processing. (rsProcessingAborted)
  • Query execution failed for data set 'dsetBranch'. (rsErrorExecutingCommand)
  • Could not find stored procedure 'stpBranch'.

    But I have this procedure in the db and it runs fine in the query analyzer and the query builder window in report project. When I refresh the page in Report manager, I am getting this error.

    Input string was not in a correct format.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.FormatException: Input string was not in a correct format.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [FormatException: Input string was not in a correct format.] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753715 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102 Microsoft.Reporting.WebForms.ReportAreaPageOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +149 Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +75 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

    I have changed the dataset from procedure to a sql string and the report is working fine everywhere. But I have a business requirement that I need to use a stored procedure.

    I am not sure why I am getting this error and I greatly appreciate any help.

    Thanks

    ngk,

    I have seen this before. Are you using any schema namespaces in your stored procedure name.

    Such as HumanResources.GetAllEmployees instead of the old default of dbo.GetAllEmployees.

    If so are you also running your stored procedures in Query Analyser as the "SAME" user that your Report Datasource uses.
    Pay close attention to these details...

    I have seen where 1 sql user has the default schema set to HumanResources and the stored procedure call is made such as exec GetAllEmployees instead of
    exec HumanResources.GetAllEmployees.

    In this situation any user that makes the first call (exec GetAllEmployees ) and has the default schema of HumanResources will succeed.
    Any user that does not have this default will return an error because it is looking for dbo.GetAllEmployees and this may not exist.

    Hope this helps.. if not please provide more details on what users you are using and the exact call you are making for the stored procedure.

    |||

    Hi Bret,

    Thanks for the info. I am not using any schema namespaces in my stored procedures. I actually got this error when I tried to connect to a remote sql server. Now I have installed developer editon on my local machine and I have reporting services also on my local machine. I have been able to connect to the strored procedures and deploy the reports to the local report server and view the reports without any problems. I am not sure whether I may have to face the same issue when the reports are deployed to the remote SQL DB and Reporting Services production servers.

    Thanks

  • Problem with accessing stored procedure in the report

    Hi,

    I am new to Sql Server 2005 Reporitng Services. I created a report in BI and used stored procedure as a dataset. When I run the report in preview mode it works fine and when I run it in report server/report manager, I am getting the following error:

  • An error has occurred during report processing. (rsProcessingAborted)
  • Query execution failed for data set 'dsetBranch'. (rsErrorExecutingCommand)
  • Could not find stored procedure 'stpBranch'.

    But I have this procedure in the db and it runs fine in the query analyzer and the query builder window in report project. When I refresh the page in Report manager, I am getting this error.

    Input string was not in a correct format.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.FormatException: Input string was not in a correct format.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [FormatException: Input string was not in a correct format.] System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753715 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102 Microsoft.Reporting.WebForms.ReportAreaPageOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +149 Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +75 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

    I have changed the dataset from procedure to a sql string and the report is working fine everywhere. But I have a business requirement that I need to use a stored procedure.

    I am not sure why I am getting this error and I greatly appreciate any help.

    Thanks

    ngk,

    I have seen this before. Are you using any schema namespaces in your stored procedure name.

    Such as HumanResources.GetAllEmployees instead of the old default of dbo.GetAllEmployees.

    If so are you also running your stored procedures in Query Analyser as the "SAME" user that your Report Datasource uses.
    Pay close attention to these details...

    I have seen where 1 sql user has the default schema set to HumanResources and the stored procedure call is made such as exec GetAllEmployees instead of
    exec HumanResources.GetAllEmployees.

    In this situation any user that makes the first call (exec GetAllEmployees ) and has the default schema of HumanResources will succeed.
    Any user that does not have this default will return an error because it is looking for dbo.GetAllEmployees and this may not exist.

    Hope this helps.. if not please provide more details on what users you are using and the exact call you are making for the stored procedure.

    |||

    Hi Bret,

    Thanks for the info. I am not using any schema namespaces in my stored procedures. I actually got this error when I tried to connect to a remote sql server. Now I have installed developer editon on my local machine and I have reporting services also on my local machine. I have been able to connect to the strored procedures and deploy the reports to the local report server and view the reports without any problems. I am not sure whether I may have to face the same issue when the reports are deployed to the remote SQL DB and Reporting Services production servers.

    Thanks

  • Problem with accessing stored procedure in the report

    Hi,

    I am new to Sql Server 2005 Reporitng Services. I created a report in BI and used stored procedure as a dataset. When I run the report in preview mode it works fine and when I run it in report server/report manager, I am getting the following error:

  • An error has occurred during report processing. (rsProcessingAborted)

  • Query execution failed for data set 'dsetBranch'. (rsErrorExecutingCommand)

  • Could not find stored procedure 'stpBranch'.

    But I have this procedure in the db and it runs fine in the query analyzer and the query builder window in report project. When I refresh the page in Report manager, I am getting this error.

    Input string was not in a correct format.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.FormatException: Input string was not in a correct format.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [FormatException: Input string was not in a correct format.]

    System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753715

    System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102

    Microsoft.Reporting.WebForms.ReportAreaPageOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +149

    Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +75

    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

    I have changed the dataset from procedure to a sql string and the report is working fine everywhere. But I have a business requirement that I need to use a stored procedure.

    I am not sure why I am getting this error and I greatly appreciate any help.

    Thanks

    ngk,

    I have seen this before. Are you using any schema namespaces in your stored procedure name.

    Such as HumanResources.GetAllEmployees instead of the old default of dbo.GetAllEmployees.

    If so are you also running your stored procedures in Query Analyser as the "SAME" user that your Report Datasource uses.
    Pay close attention to these details...

    I have seen where 1 sql user has the default schema set to HumanResources and the stored procedure call is made such as exec GetAllEmployees instead of
    exec HumanResources.GetAllEmployees.

    In this situation any user that makes the first call (exec GetAllEmployees ) and has the default schema of HumanResources will succeed.
    Any user that does not have this default will return an error because it is looking for dbo.GetAllEmployees and this may not exist.

    Hope this helps.. if not please provide more details on what users you are using and the exact call you are making for the stored procedure.

    |||

    Hi Bret,

    Thanks for the info. I am not using any schema namespaces in my stored procedures. I actually got this error when I tried to connect to a remote sql server. Now I have installed developer editon on my local machine and I have reporting services also on my local machine. I have been able to connect to the strored procedures and deploy the reports to the local report server and view the reports without any problems. I am not sure whether I may have to face the same issue when the reports are deployed to the remote SQL DB and Reporting Services production servers.

    Thanks

  • Wednesday, March 21, 2012

    Problem with 2 Dataset Sharing Parameters

    I have a report that will pull out a list of bugs assigned to users for a
    period of time (@.StartDate, @.EndDate). Optionally the report has option to
    select a single user (@.UserName) or just all of them. There are 2 datasets.
    First dataset: Bugs requires 3 parameters: @.StartDate, @.EndDate, @.UserName.
    Second dataset: UserName. At first I have a query to list all users. Since
    the list has hundreds of users while the result set from dataset Bugs mostly
    has less than 10 users, I built another query to list only users having bugs
    assigned from @.StartDate to @.EndDate. So it requires 2 parameters @.StartDate
    and @.Enddate.
    Now both datasets use @.StartDate and @.EndDate. The list to select for
    @.UserName is produced after @.StartDate and @.EndDate are entered. I expected
    the report to let me select the username after I enter @.StartDate and
    @.EndDate. However in the preview tab right at the moment when I clicked on
    the box for @.EndDate to enter a value the program hang up (VS 2003). I
    uploaded it to a report server to see how it behaves then I got this error
    after I click on the EndDate box: The value provided for the report
    parameter 'EndDate' is not valid for its type.
    (rsReportParameterTypeMismatch).
    I don't know what's wrong. If I change the dataset UserName to list all
    users (no parameter required) then the report runs fine. I use Visual
    Studio .NET 2003 Service Pack 1, report server is SQL 2000 with latest SP on
    the O/S, SQL, and SQL RS.
    An thought?
    Thanks.On May 2, 5:31 pm, "ME" <M...@.mail.com> wrote:
    > I have a report that will pull out a list of bugs assigned to users for a
    > period of time (@.StartDate, @.EndDate). Optionally the report has option to
    > select a single user (@.UserName) or just all of them. There are 2 datasets.
    > First dataset: Bugs requires 3 parameters: @.StartDate, @.EndDate, @.UserName.
    > Second dataset: UserName. At first I have a query to list all users. Since
    > the list has hundreds of users while the result set from dataset Bugs mostly
    > has less than 10 users, I built another query to list only users having bugs
    > assigned from @.StartDate to @.EndDate. So it requires 2 parameters @.StartDate
    > and @.Enddate.
    > Now both datasets use @.StartDate and @.EndDate. The list to select for
    > @.UserName is produced after @.StartDate and @.EndDate are entered. I expected
    > the report to let me select the username after I enter @.StartDate and
    > @.EndDate. However in the preview tab right at the moment when I clicked on
    > the box for @.EndDate to enter a value the program hang up (VS 2003). I
    > uploaded it to a report server to see how it behaves then I got this error
    > after I click on the EndDate box: The value provided for the report
    > parameter 'EndDate' is not valid for its type.
    > (rsReportParameterTypeMismatch).
    > I don't know what's wrong. If I change the dataset UserName to list all
    > users (no parameter required) then the report runs fine. I use Visual
    > Studio .NET 2003 Service Pack 1, report server is SQL 2000 with latest SP on
    > the O/S, SQL, and SQL RS.
    > An thought?
    > Thanks.
    The issue sounds kind of strange. Maybe you should check to make sure
    that you have the correct @.EndDate mapping as part of the UserName
    dataset (via the Data tab -> Edit Selected Dataset button [...] ->
    Parameters tab). Also, make sure that the stored procedure/query that
    sources the UserName dataset is not expecting a different data type
    for @.EndDate (for whatever reason). Sorry I could not be of greater
    assistance.
    Regards,
    Enrique Martinez
    Sr. Software Consultant|||Thanks for the reply. I use datatime as data type for @.StartDate, @.EndDate
    in both datasets. Double checked everything but still have no clue why.
    When I learned and practiced SQL 2005 I had no problem doing similar thing.
    "EMartinez" <emartinez.pr1@.gmail.com> wrote in message
    news:1178160515.514988.169100@.e65g2000hsc.googlegroups.com...
    > On May 2, 5:31 pm, "ME" <M...@.mail.com> wrote:
    >> I have a report that will pull out a list of bugs assigned to users for a
    >> period of time (@.StartDate, @.EndDate). Optionally the report has option
    >> to
    >> select a single user (@.UserName) or just all of them. There are 2
    >> datasets.
    >> First dataset: Bugs requires 3 parameters: @.StartDate, @.EndDate,
    >> @.UserName.
    >> Second dataset: UserName. At first I have a query to list all users.
    >> Since
    >> the list has hundreds of users while the result set from dataset Bugs
    >> mostly
    >> has less than 10 users, I built another query to list only users having
    >> bugs
    >> assigned from @.StartDate to @.EndDate. So it requires 2 parameters
    >> @.StartDate
    >> and @.Enddate.
    >> Now both datasets use @.StartDate and @.EndDate. The list to select for
    >> @.UserName is produced after @.StartDate and @.EndDate are entered. I
    >> expected
    >> the report to let me select the username after I enter @.StartDate and
    >> @.EndDate. However in the preview tab right at the moment when I clicked
    >> on
    >> the box for @.EndDate to enter a value the program hang up (VS 2003). I
    >> uploaded it to a report server to see how it behaves then I got this
    >> error
    >> after I click on the EndDate box: The value provided for the report
    >> parameter 'EndDate' is not valid for its type.
    >> (rsReportParameterTypeMismatch).
    >> I don't know what's wrong. If I change the dataset UserName to list all
    >> users (no parameter required) then the report runs fine. I use Visual
    >> Studio .NET 2003 Service Pack 1, report server is SQL 2000 with latest SP
    >> on
    >> the O/S, SQL, and SQL RS.
    >> An thought?
    >> Thanks.
    >
    > The issue sounds kind of strange. Maybe you should check to make sure
    > that you have the correct @.EndDate mapping as part of the UserName
    > dataset (via the Data tab -> Edit Selected Dataset button [...] ->
    > Parameters tab). Also, make sure that the stored procedure/query that
    > sources the UserName dataset is not expecting a different data type
    > for @.EndDate (for whatever reason). Sorry I could not be of greater
    > assistance.
    > Regards,
    > Enrique Martinez
    > Sr. Software Consultant
    >

    Tuesday, March 20, 2012

    Problem while using stored procedures with temporary tables in dataset

    I am trying to generate a report using SQL Server Reporting Service. The dataset is passed the results from a stored procedure. The stored proc contains a temporary table. On exceuting of proc, it fetches the result but when I try to save dataset I get following error message

    Invalid object name '#AdditionalParams'. (.Net SqlClient Data Provider)

    And no colums are returned in the data set created.

    Any help on this would be appreciated.

    Thanks in advance

    If possible, try using a table variable instead, or create a physical table first.

    http://www.odetocode.com/Articles/365.aspx

    Here are some workarounds for temp tables.

    http://www.sql-server-performance.com/rd_temp_tables.asp

    If you have to, try using set fmtonly off in stored procedure.

    http://www.simple-talk.com/sql/database-administration/creating-csv-files-using-bcp-and-stored-procedures/

    cheers,

    Andrew

    |||

    I exceuted the proc as stored procedure. And latter I added a new field to same dataset, as it didnt had any field because it had thrown error. I refreshed the datset and I got all the dataset fields although initally it showed error and it worked.

    But their is essentially problem the way datset are handled in reporting service.

    Thanks

    Problem while using stored procedures with temporary tables in dataset

    I am trying to generate a report using SQL Server Reporting Service. The dataset is passed the results from a stored procedure. The stored proc contains a temporary table. On exceuting of proc, it fetches the result but when I try to save dataset I get following error message

    Invalid object name '#AdditionalParams'. (.Net SqlClient Data Provider)

    And no colums are returned in the data set created.

    Any help on this would be appreciated.

    Thanks in advance

    If possible, try using a table variable instead, or create a physical table first.

    http://www.odetocode.com/Articles/365.aspx

    Here are some workarounds for temp tables.

    http://www.sql-server-performance.com/rd_temp_tables.asp

    If you have to, try using set fmtonly off in stored procedure.

    http://www.simple-talk.com/sql/database-administration/creating-csv-files-using-bcp-and-stored-procedures/

    cheers,

    Andrew

    |||

    I exceuted the proc as stored procedure. And latter I added a new field to same dataset, as it didnt had any field because it had thrown error. I refreshed the datset and I got all the dataset fields although initally it showed error and it worked.

    But their is essentially problem the way datset are handled in reporting service.

    Thanks

    Saturday, February 25, 2012

    Problem Using Stored Procedures in Report Datasets

    I have a local Reporting Services report that I am modifying to use a stored procedure.

    Although I am executing a stored procedure in the dataset query window, I also have to run a SELECT statement to retrieve the fields from a table that will populate the report.

    The code that I have in the dataset query window looks like the following:

    EXECUTE @.retCode = RunClaimVerification @.parmID, @.parmDate, @.parmRecordID OUTPUT

    SELECT *

    FROM ClaimsDetail

    WHERE ClaimRecordID = @.parmRecordID

    When I execute this code, the only results that are returned SEEM TO BE the return code associated with running the stored procedure.

    I thought about putting the SELECT code in the stored procedure and returning a table or a cursor from the stored procedure BUT it looks like tables are not supported as Report Parameter data types.

    The stored procedure code generates Claim data that is stored in a SQL Table. The fields in this SQL table need to be retrieved by a unique record id to populate the fields in the report.

    Does anybody have any suggestions as to how to go about doing this OR any suggestions that would help me resolve this problem?


    Reporting Services only allows one result (table or the return value of a stored procedure) to be retrieved per query. This is the reason that only the return code seems to be included in the dataset. Also, out parameters for stored procedures are not supported in Reporting Services.

    Try changing the stored procedure to also Select the data from the ClaimsDetail table, and return the resultant table instead of the return code. However, don't set the return value to a parameter--just execute the stored procedure. This should produce a dataset containing the results of the Select statement.

    Ian