SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Junk in my tables


Junk in my tables

Author
Message
Bad_Karma
Bad_Karma
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 190
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?
PB_BI
PB_BI
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1952 Visits: 2515
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
Bad_Karma
Bad_Karma
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 190
It's SQL Server 2012, so it's BIDS 2010, and I'm opening the file using Excel 2013.
PB_BI
PB_BI
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1952 Visits: 2515
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 :rolleyesSmile or does it happen when you have deployed the report?




I'm on LinkedIn
Bad_Karma
Bad_Karma
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 190
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?
PB_BI
PB_BI
SSCommitted
SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)SSCommitted (2K reputation)

Group: General Forum Members
Points: 1952 Visits: 2515
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
Steven.Howes
Steven.Howes
SSC Eights!
SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)

Group: General Forum Members
Points: 872 Visits: 2340
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.
Bad_Karma
Bad_Karma
SSC Journeyman
SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)SSC Journeyman (91 reputation)

Group: General Forum Members
Points: 91 Visits: 190
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.
Steven.Howes
Steven.Howes
SSC Eights!
SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)SSC Eights! (872 reputation)

Group: General Forum Members
Points: 872 Visits: 2340
what if you did a REPLACE on the text when you pull it into your report?

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


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search