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

Excel Datasource brings in a couple of numeric fields as nulls? Expand / Collapse
Author
Message
Posted Thursday, July 20, 2006 10:27 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, March 18, 2010 3:56 PM
Points: 73, 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

 

Post #295964
Posted Friday, July 21, 2006 12:28 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, September 11, 2008 4:03 AM
Points: 325, 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"

 

 

 

Post #296142
Posted Friday, July 21, 2006 7:06 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, September 5, 2006 7:04 AM
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.
Post #296237
Posted Friday, July 21, 2006 8:56 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, January 24, 2014 8:40 PM
Points: 174, 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.

Post #296319
Posted Friday, July 21, 2006 10:52 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, March 18, 2010 3:56 PM
Points: 73, 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

Post #296391
Posted Tuesday, July 25, 2006 7:51 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, September 5, 2013 7:04 AM
Points: 1,197, Visits: 294
...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...


Post #297075
Posted Tuesday, July 25, 2006 10:22 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, March 18, 2010 3:56 PM
Points: 73, 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

Post #297146
Posted Tuesday, June 4, 2013 5:25 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, November 27, 2013 11:48 AM
Points: 10, Visits: 48
On a 64 bit machine it is set here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Jet\4.0\Engines\Excel
Post #1459993
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse