473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Reading data from Excel...

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
Jul 20 '05 #1
1 4304
"piero" <g.*******@pesaroservice.com> wrote in message news:<bq**********@serv1.iunet.it>...
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


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
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dariusz | last post by:
Below is part of a code I have for a database. While the database table is created correctly (if it doesn't exist), and data is input correctly into the database when executed, I have a problem...
0
by: Andy | last post by:
Hi, In the code below (not pretty I know but it's an early version :-P) I'm having problems reading the data object back in. If I move the reading code to immediately after the section where it...
1
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but...
15
by: djj858 | last post by:
Another newbie question: How do I begin reading data, but starting from the xth line down a list? In other words, how do I skip the first lines and not read in those values?
1
by: Turner, GS \(Geoff\) | last post by:
> -----Original Message----- > From: siliconwafer > Posted At: 19 August 2005 15:20 > Posted To: c > Conversation: reading an excel file in C? > Subject: reading an excel file in C? > > >...
4
by: Phoebe. | last post by:
Hi, Good Day! Reading 1 excel file into a dataset is fine. How can I read multiple excel with the same data structure into 1 dataset? How can I append those data? Can someone help? Thanks in...
1
by: Gomathi | last post by:
hi, I'm reading an excel sheet which contains more than 500 chars in a single column using OledbDataReader. But while reading value using dr.toString(), its taking only 255 chars. It removed the...
3
by: ramona chauhan | last post by:
Hi This is ramona . i want to know the code for reading an excel file. please provide the required code.
1
by: vtangella | last post by:
Hi Guys! Here i am using Apache POI for reading the Excel sheet in java and then i am capturing the excel sheet data into a ArrayList and then i am storing it in DB. Any Other way to store...
1
by: =?Utf-8?B?U2hlZXMgQWJpZGk=?= | last post by:
I read an article on the link: http://support.microsoft.com/default.aspx?scid=kb;en-us;306572 related to reading data from Excel using OLEDB The topic's heading is: How to query and display excel...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.