SSRS 2005: Implicit conversion from data type sql_variant to varchar is not allowed.

  • I have an SP that extracts data to present in a report. The report was originally written in Crystal and works fine. I'm trying to write the same report in SSRS 2005. When I specify the SP as the query I get the message:

    There is an error in the query. Implicit conversion from data type sql_variant to varchar is not allowed. Use the CONVERT function to run this query.

    The SP defines a temp table, inserts a bunch of data from the DB into the temp table, updates rows selectively based on a couple of update queries, then selects the data out of the temp table and drops the temp table. The temp table definition uses explicit types for all columns (mostly varchar and int). Why am I getting this error in SSRS??

     

  • I think I just answered my own question. While I was writing up the post something lurked in the back of my mind about temp tables vs. table variables being problems.

    I converted the SP to use Table Variables instead of temp tables and it works now.

    If anyone has a good explanation as to why this is I'd still appreciate understanding it... 😉

     

  • thank u very much man..i had been longing 4 this answer for the past one year..once again thank u and love u

  • I am trying to create a report with an sp which has a select f1, f2 From a table variable.

    But when I specify the sp in SSRS RDL, it is throws an error.

    - Must declare the table variable ' '.

    How and where do i declare it, ? Its already declared in the sp.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply