|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, April 04, 2013 9:03 AM
Points: 28,
Visits: 411
|
|
HI, I've few issues after exporting the SSRS report to Excel Mode.
How do i stop Excel from deleting leading zeros permanently and not having to change the number type.
While clicking Excel cel,. value changed to 123 from 00123. How do prevent the change of value (00123 -> 123)
Also is there a way to stop Excel from change long numbers eg. 321312321303 to 3.21E+10.
Thanks, J
|
|
|
|
|
SSChampion
        
Group: General Forum Members
Last Login: Today @ 5:14 PM
Points: 11,648,
Visits: 27,758
|
|
excel automatically treats anything that looks like a number as a number, dates as dates, etc I believe you'd have to change you report of the data to explicitly place a single quote in the field, which is how Excel knows to override the behavior and treat the value as text... that's annoying, because you have to do something like this:
SELECT '''' + TheCode As TheCode, '''' + '00123' As TheValue, '''' + CONVERT(VARCHAR,321312321303) As TheDecimal FROM YourTable
Lowell
--There is no spoon, and there's no default ORDER BY in sql server either. Actually, Common Sense is so rare, it should be considered a Superpower. --my son
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, April 04, 2013 9:03 AM
Points: 28,
Visits: 411
|
|
Thanks, when I use this option, Excel values are precedes with ' code. Is any work around to remove the ' code in reporting side.
Ty J
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 11:32 AM
Points: 26,
Visits: 178
|
|
I've had this problem for years with web application development. Adding a single apostrophe (') is the best option. Unfortunately, Excel will always attempt to format the data based on the value. Anything that looks like a number will automatically be formatted as a number; anything that looks like a date will be formatted like a date; etc... You will have to add a symbol (apostrophe, dash, etc...) in front of the number so that Excel thinks the value is plain text.
The option that I use is to do nothing. If the spreadsheet is going to an end-user, I make sure they understand how to format the data. So they manually format the column to show the leading zeros. The reason that I went with this option is for calculation purposes. If the end-user needs to perform a calculation on the values, it's very difficult when the value has a leading symbol. However, if you do not need to perform a calculation on the value, adding a leading symbol might be your best option.
HTH.
Mike
|
|
|
|
|
SSCrazy Eights
        
Group: General Forum Members
Last Login: Today @ 2:11 AM
Points: 9,378,
Visits: 6,473
|
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Tuesday, April 30, 2013 11:32 AM
Points: 26,
Visits: 178
|
|
Hey J -
Just curious... how did you solve this?
Mike
|
|
|
|