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


Excel Datasource brings in a couple of numeric fields as nulls?


Excel Datasource brings in a couple of numeric fields as nulls?

Author
Message
M Shah
M Shah
Old Hand
Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)

Group: General Forum Members
Points: 369 Visits: 51

I have the Excel Connection Manager and Source to read the contents from an Excel file. For some reason couple of numeric fields from the Excel worksheet are brought over as nulls even though they have a value of 300 and 150. I am not sure why this is happening. I looked into the format of the fields and they are set to General in Excel, I tried setting them to numeric and that did not help.

All the other content from the excel file is coming thru except for the 2 numeric fields.

I tried to bring the contents from the excel source to a text file in csv format and for some reason the 2 numeric fields came out as blank.

Any inputs on getting this addressed will be much appreciated.

Thanks,

Manisha


l0n3i200n
l0n3i200n
SSC-Addicted
SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)SSC-Addicted (473 reputation)

Group: General Forum Members
Points: 473 Visits: 36

Hi M_shah

You could try to change the registry entry for the driver you are using, by default it is set to 8. Make it a bigger amount like 1000. I'm using the following with in Yukon to import data to sql. ( this needs to happen on the Server not your machine ) "TypeGuessRows" is the key value you need to change

SELECT *

INTO #TempTable

FROM OPENROWSET ('Microsoft.Jet.OleDB.4.0', 'Excel 8.0;HDR=YES;IMEX=1;Database=C:\HelloWorld.xls;User ID=;Password=;','SELECT * FROM [Sheet1$A2:E10000]');

HDR = Yes just means 1st row is the header row

IMEX = 1 Is the default

Windows Registry Editor Version 5.00

*********REGISTRY STUFFF**********

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\4.0\Engines\Excel]
"win32"="C:\\Program Files\\Microsoft Office\\OFFICE11\\msaexp30.dll"
"DisabledExtensions"="!xls"
"ImportMixedTypes"="Text"
"FirstRowHasNames"=hex:01
"AppendBlankRows"=dword:00000001
"TypeGuessRows"=dword:00000000
"win32old"="C:\\WINDOWS\\System32\\msexcl40.dll"


Cindy Tavarez
Cindy Tavarez
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 1
I've had a similar issue when importing data from excel in my asp pages. If you put a tick mark in front of the numbers in excel it will convert the number into text. You should see a little triange in the upper left corner of the cell when you add the tick mark. It should come through ok after that.
Bill Scott
Bill Scott
SSChasing Mays
SSChasing Mays (608 reputation)SSChasing Mays (608 reputation)SSChasing Mays (608 reputation)SSChasing Mays (608 reputation)SSChasing Mays (608 reputation)SSChasing Mays (608 reputation)SSChasing Mays (608 reputation)SSChasing Mays (608 reputation)

Group: General Forum Members
Points: 608 Visits: 454

I have always found it to be easiest to import stuff from whatever file source into a temporary import table that has all the columns defined as varchar(big enough). import the data into the varchar columns, then look for anything that needs to be fixed up, like removing those tick marks before you numbers. i'll usually use a series of queries to do this kind of data fixup and looking for invalid values so i can report them. When the data is clean, then i copy it to the "real" table and convert the data types during the copy.

once the data is in the "real" table you can continue with the rest of the process that works with the information.


M Shah
M Shah
Old Hand
Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)

Group: General Forum Members
Points: 369 Visits: 51

Hi l0n3i200n

The SQL Server 2005 install is on a 64 bit machine and I do not see

Jet under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft in the registry.

I see that entry on my local machine in the registry.

Is there some other location in the registry where the 32 bit drivers are registered at?

Thanks,

Manisha


Hans Lindgren
Hans Lindgren
SSCrazy
SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)SSCrazy (2.8K reputation)

Group: General Forum Members
Points: 2820 Visits: 366
...and if the Excel team hasn't fixed the bug with the 'guess rows' parameter you should watch out for wrong data anyway. If the Excel Import determines that one column is VARCHAR it will replace any cells containing just numerics with NULLs...



M Shah
M Shah
Old Hand
Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)Old Hand (369 reputation)

Group: General Forum Members
Points: 369 Visits: 51

I made the change suggested with guess rows and that works on a 32 bit machine, but my Sql Server 2005 is on a 64 bit machine and there is no excel installed on that. When I run a job containing an excel datasource I specify the DTExec32.exe to run the job. In that scenario where does the guessrows parameter be set in the registry please let me know. Any inputs will be much appreciated.

Thanks,

Manisha


jording
jording
SSC Rookie
SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)SSC Rookie (34 reputation)

Group: General Forum Members
Points: 34 Visits: 53
On a 64 bit machine it is set here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Jet\4.0\Engines\Excel
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