Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading data from Excel...

1 view
Skip to first unread message

piero

unread,
Nov 28, 2003, 2:13:27 AM11/28/03
to
Hi,
I have a Excel sheet that have a column with mixed data:
column can contain data like "892-234-32A" or like "892298343233432"

I need to get all data column such as "text" to avoid numeric field show as
exponential number.

I'm trying with:
SELECT CAST (CODICE as bigint(25)) FROM
OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel
8.0;IMEX=1;HDR=YES;Database=C:\tempxadp\dist1.xls', Foglio1$)

But I get error conversion type "from nvarchar to bigint" when query meet
the alphanumeric field.

Any tips ?

Thanks in advance

Piero

Italy


Simon Hayes

unread,
Nov 28, 2003, 8:04:07 AM11/28/03
to
"piero" <g.pa...@pesaroservice.com> wrote in message news:<bq6sin$f9n$1...@serv1.iunet.it>...

Here is one possibility, which will return only integers:

select cast(CODICE as bigint)
from ...
where CODICE not like '%[^0-9]%'

bigint(25) is incorrect, by the way.

Simon

0 new messages