Junk in my tables

  • Somehow I've ended up with junk characters in my database, and when I export to Excel using SSRS, excel just deletes the entire contents due to the invalid character. I've found the character in my database, but I don't know how it got saved. It looks like a miniature upside down capital L. Anyway, if that could make it in there, I'm sure other junk can too. Is there a list somewhere of "illegal" characters that SSRS doesn't know how to export, that I can just do searches for? Or do I have to just make a list of all the "valid" characters and just strip out any that don't belong?

  • Sounds like it might be an illegal xml character. What version of SSRS are you running and what version of Excel are you exporting to?


    I'm on LinkedIn

  • It's SQL Server 2012, so it's BIDS 2010, and I'm opening the file using Excel 2013.

  • Hmmmm, what is the data type of the particular column in the database?

    Sometimes users can put strange characters into varchars and nvarchars like tabs and carriage returns so you could try doing a trim in your query - LTRIM(RTRIM(your column)) to get rid of certain undesirables. Or there is a more comprehensive function here.

    I found this thread which describes a similar problem and may be of assistance.

    Does it just occur when you try to export from SSDT (formerly BIDS :rolleyes:) or does it happen when you have deployed the report?


    I'm on LinkedIn

  • The column is a varchar(1000), it's a free form user field from a 3rd party app, specifically it's for "notes". There are carriage returns in there, but I've never had issues with that. Here is the closest I can find to what I'm seeing "¬", it's not being handled by ltrims. SSRS renders it just fine in report manager, and it actually successfully exports it to Excel. The problem is when I open the excel file that it blows up and I lose all of the contents.

    I know that I can just get rid of the character in SQL, or save to a lower version of excel, but what I'm really looking for is a way to catch this type of thing ahead of time in the future. Does anyone know a way to semi-efficiently search through a note field like this for characters that aren't standard?

  • Have a look at the trim function I linked to above. You can specify characters that you need to have removed from the column. Either that or identify the guilty characters and do a big nested REPLACE but that could get messy.


    I'm on LinkedIn

  • if you query that table and look for that entry with the bad character, what does it look like in SSMS? I'm wondering if it's a accented letter, french spanish, etc. I've had that blow things up on me before, though never on an export from SSRS to excel.

  • That's what it looks like, it even looks that way when I pull up the note in the application that saved it. I'm pretty sure that's the exact character, just not the same font. U+00AC is the character map generation of it.

  • what if you did a REPLACE on the text when you pull it into your report?

    REPLACE(ColumnName,CHAR(0XAD),'X')

Viewing 9 posts - 1 through 8 (of 8 total)

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