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

Problem with EXCEL Expand / Collapse
Author
Message
Posted Thursday, April 22, 2010 12:15 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:39 AM
Points: 202, Visits: 1,047
i had to load the data from sql server data base tables. i used store procedure to load the data .the stored procedure gives three columns when i run it
so my source is sql server
i had to create a table in excel and load the data into the three colums
i had to create an excel table with three colums.
CREATE TABLE `New Table` (
`column a` VarChar (9) ,
`column b` VarChar (8) ,
`column c` VarChar (254) )
when i do data conversions and when i load the data the first two columns are getting loaded properly.the third column is loading in this fashion '0123 i have to get 0123 only i am getting '0123 in my third column.
when i did my data conversions i had used each of these options( DT_WSTR , DT_NTEXT) .
when i use these options i get the above mentioned issue '0123 but not 0123.
please can any one help me with this

Thank You,
Post #908901
Posted Thursday, April 22, 2010 12:46 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, July 15, 2014 10:26 AM
Points: 823, Visits: 1,203
Is the leading zero required? If it is and you are using a template excel file and not a new file then set that field as text in your template file. If you are not using a template file you might want to.
As I understand it the first row is sampled in the result set and if a leading zero is found then it treats it like text and adds the single quote. If the leading zero is not required you can also cast or convert in the sql statement so that the number is treated correctly.

I have had this same problem and while I think the explanation is a little odd that SQL treats a leading zero in this way I do find that either of the two steps I mention have fixed it for me.


Dan

If only I could snap my figures and have all the correct indexes apear and the buffer clean and.... Start day dream here.
Post #908920
Posted Friday, April 23, 2010 1:23 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Sunday, July 20, 2014 11:20 PM
Points: 13,252, Visits: 10,133
sql2k8 (4/22/2010)

when i use these options i get the above mentioned issue '0123 but not 0123.


Putting '0123 in Excel is the same as 0123. The ' serves as a text identifier, so that Excel knows that it is text and not a number, otherwise it would drop the leading zero.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #909229
Posted Friday, April 23, 2010 7:29 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 9, 2011 2:30 AM
Points: 4, Visits: 20
i'm agree with Da Zero (like always :) )

but what u can try is to add a fake first line with a text in the third column.

another thing is that Excel format the data with the top ten (not sure about the number, maybe more, maybe less) rows of the dataset.

There is an option to change the number of line that are analyzed by excel.

this is a key is the reg db

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel\TypeGuessRows

hope it helps


Post #909442
Posted Friday, April 23, 2010 1:11 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Tuesday, March 4, 2014 8:39 AM
Points: 202, Visits: 1,047
when i changed colum c data type to int in the template new table



and when i did the data conversion to 8 bit unsigned integer in my data flow task. i was able to eliminate the single quote problem.

thank you very much for your help
Post #909775
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse