Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Junk in my tables Expand / Collapse
Author
Message
Posted Monday, January 13, 2014 8:15 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 4, 2014 7:54 AM
Points: 48, Visits: 164
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?
Post #1530307
Posted Monday, January 13, 2014 8:50 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 1:37 AM
Points: 585, Visits: 1,152
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
Post #1530332
Posted Monday, January 13, 2014 11:15 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 4, 2014 7:54 AM
Points: 48, Visits: 164
It's SQL Server 2012, so it's BIDS 2010, and I'm opening the file using Excel 2013.
Post #1530392
Posted Tuesday, January 14, 2014 3:09 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 1:37 AM
Points: 585, Visits: 1,152
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 ) or does it happen when you have deployed the report?





I'm on LinkedIn
Post #1530585
Posted Tuesday, January 14, 2014 7:37 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 4, 2014 7:54 AM
Points: 48, Visits: 164
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?
Post #1530683
Posted Tuesday, January 14, 2014 8:00 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 1:37 AM
Points: 585, Visits: 1,152
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
Post #1530698
Posted Tuesday, January 14, 2014 8:08 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: 2 days ago @ 8:08 AM
Points: 609, Visits: 2,137
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.
Post #1530705
Posted Tuesday, January 14, 2014 8:11 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, September 4, 2014 7:54 AM
Points: 48, Visits: 164
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.
Post #1530706
Posted Tuesday, January 14, 2014 8:24 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: 2 days ago @ 8:08 AM
Points: 609, Visits: 2,137
what if you did a REPLACE on the text when you pull it into your report?

REPLACE(ColumnName,CHAR(0XAD),'X')
Post #1530714
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse