April 22, 2010 at 12:15 pm
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,
April 22, 2010 at 12:46 pm
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.
April 23, 2010 at 1:23 am
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.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
April 23, 2010 at 7:29 am
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
April 23, 2010 at 1:11 pm
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
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply