dbTalk Databases Forums  

SQL OpenRowSet Excel 255 character length issue

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss SQL OpenRowSet Excel 255 character length issue in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sorourke1@hotmail.com
 
Posts: n/a

Default SQL OpenRowSet Excel 255 character length issue - 08-12-2005 , 07:19 AM






I have an Excel spreadsheet that I'm trying to import into a SQL Server
2000 database. I'm using OpenRowSet to import the data and it works
great unless there is data in an Excel cell that exceeds 255
characters. When a cell contains > 255 characters, I get the following
error (when run from Query Analyser):


[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionCheÂ*ckForData
(CheckforData()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.

Connection Broken


Here's the SQL that I'm trying to run. In the example below, I have a
field called "Company Notes". When it exceeds 255 characters, the
error occurs.

create table #foo (t text)

insert into #foo (t)
Select [company notes]
Quote:
From OpenRowSet('Microsoft.Jet.OLEDÂ*B.4.0', 'Excel
8.0;Database=C:\test.xls;HDR=YÂ*ES;IMEX=1', ['Sheet1$'])

I have been tried to modifing the regestry entry
HKEY_LOCAL_MACHINE\SOFTWARE\MiÂ*Â*crosoft\Jet\4.0\ Engines\ExcelÂ*\Â*TypeGuessRows
and set this from 8 to 0
and
HKEY_LOCAL_MACHINE\SOFTWARE\MiÂ*Â*crosoft\Jet\4.0\ Engines\ExcelÂ*\Â*ImportMixedTypes
is set to Text

How can I import data > 255 characters in length?

Thank you in advance for the help!


Reply With Quote
  #2  
Old   
Douglas Laudenschlager [MS]
 
Posts: n/a

Default Re: SQL OpenRowSet Excel 255 character length issue - 08-12-2005 , 05:57 PM






It looks to me at first glance as if the steps you've taken should have
avoided this issue.

IMEX and the ImportMixedTypes setting aren't relevant here to the
determination the driver is making as to whether a string column contains
strings of less than or greater than 255 characters. It needs to find a row
(in the rows that it samples) with a column value longer than 255, as you
know, in order to treat the column as a > 255 column. I've read in the past
also that setting TypeGuessRows = 0 means "all rows," but I'm not 100%
confident on that point...have you tried setting it to a larger whole number
value, or putting a >255 value in the first row?

-Doug

--
Douglas Laudenschlager
Microsoft SQL Server documentation team
Redmond, Washington, USA

This posting is provided "AS IS" with no warranties, and confers no rights.

"sorourke1 (AT) hotmail (DOT) com" <sorourke1hotmailcom (AT) discussions (DOT) microsoft.com>
wrote in message news:954587CB-5D83-4C1F-BF1C-6BEC017FB081 (AT) microsoft (DOT) com...
Quote:
I have an Excel spreadsheet that I'm trying to import into a SQL Server
2000 database. I'm using OpenRowSet to import the data and it works
great unless there is data in an Excel cell that exceeds 255
characters. When a cell contains > 255 characters, I get the following
error (when run from Query Analyser):


[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionChe*ckForData
(CheckforData()).
Server: Msg 11, Level 16, State 1, Line 0
General network error. Check your network documentation.

Connection Broken


Here's the SQL that I'm trying to run. In the example below, I have a
field called "Company Notes". When it exceeds 255 characters, the
error occurs.

create table #foo (t text)

insert into #foo (t)
Select [company notes]
From OpenRowSet('Microsoft.Jet.OLED*B.4.0', 'Excel
8.0;Database=C:\test.xls;HDR=Y*ES;IMEX=1', ['Sheet1$'])

I have been tried to modifing the regestry entry
HKEY_LOCAL_MACHINE\SOFTWARE\Mi**crosoft\Jet\4.0\En gines\Excel*\*TypeGuessRows
and set this from 8 to 0
and
HKEY_LOCAL_MACHINE\SOFTWARE\Mi**crosoft\Jet\4.0\En gines\Excel*\*ImportMixedTypes
is set to Text

How can I import data > 255 characters in length?

Thank you in advance for the help!



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.