Showing posts with label sheet. Show all posts
Showing posts with label sheet. Show all posts

Friday, February 24, 2012

Excel with ADO problem

Hello,

I connect to an Excel file with ADO and I get the sheet names and after that I read the table. if the column is all integers or strings there's no problem but if the column is composed of integers and strings then only the strings are returned,others are returned empty.

What's the reason?

Thanks

Hi,

did you try this here:

http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q194124

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

Sunday, February 19, 2012

Excel to SQL server 2005

I need some pointers to help me import some data from an excel sheet into a SQL Server 2005 DB. Here is the scenario:

Each row in my excel sheet maps to three tables in the DB. Lets say there are 6 columns: Col1, Col2...Col6.

Col1 and Col2 map to DBTableA.

Col3 and Col4 map to DBTableB.

Col4 and Col6 map to DBTableC.

DBTableA's primary key is used as a foreign key in DBTableB and DBTableC.

Now what would be the best way to do this using SSIS?

I have gone through transforms and data flow tasks etc, so I am not exactly a newbie in SSIS. So it will be ok to use any SSIS specific terms in your response.

Thanks.

-Faisal

I guess the post was redundant.

After searching the forums for similar questions, I found the solution.

SSIS Nugget: Splitting order detail and order header information from one file into multiple tables

http://blogs.conchango.com/jamiethomson/archive/2006/05/22/3974.aspx

Thanks Jamie.

-Faisal

Excel to SQL 2000

I have an excel spread sheet that contains a header and three different
sections (delineated by text statements on separate lines between the data).
Header One Some Data by Name
$23,598.00 $23,598.00 $23,598.00 $23,598.00
$23,598.00 $23,598.00 $23,598.00 $23,598.00
Header Two Some Data by Name
$23,598.00 $23,598.00 $23,598.00 $23,598.00
$23,598.00 $23,598.00 $23,598.00 $23,598.00
Header Three Some Data by Name
$23,598.00 $23,598.00 $23,598.00 $23,598.00
$23,598.00 $23,598.00 $23,598.00 $23,598.00
I need to import the data from each section and import it into a different
SQL 2000 file for each section of the excel spreadsheet. I also need to
perform some data manipulation during the import.
I am a beginner so I would appreciate your advice on how to do this as well
as article, samples, links etc. that I might be able to learn from. Thank
you.Hi Mike
Check out sqldts.com for lots of information on how to do things using DTS!
The safest option would be if you can make each section a named range then
they could be imported separately. Another option, if all sections have the
same format would be to import the data into a staging table (with an
identity column) and then split it off from there (although I don't know if
the row order will be guaranteed!!!)
John
"Mike" wrote:

> I have an excel spread sheet that contains a header and three different
> sections (delineated by text statements on separate lines between the data
).
> Header One Some Data by Name
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> Header Two Some Data by Name
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> Header Three Some Data by Name
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> I need to import the data from each section and import it into a different
> SQL 2000 file for each section of the excel spreadsheet. I also need to
> perform some data manipulation during the import.
> I am a beginner so I would appreciate your advice on how to do this as wel
l
> as article, samples, links etc. that I might be able to learn from. Thank
> you.
>
>

Excel to SQL 2000

I have an excel spread sheet that contains a header and three different
sections (delineated by text statements on separate lines between the data).
Header One Some Data by Name
$23,598.00 $23,598.00 $23,598.00 $23,598.00
$23,598.00 $23,598.00 $23,598.00 $23,598.00
Header Two Some Data by Name
$23,598.00 $23,598.00 $23,598.00 $23,598.00
$23,598.00 $23,598.00 $23,598.00 $23,598.00
Header Three Some Data by Name
$23,598.00 $23,598.00 $23,598.00 $23,598.00
$23,598.00 $23,598.00 $23,598.00 $23,598.00
I need to import the data from each section and import it into a different
SQL 2000 file for each section of the excel spreadsheet. I also need to
perform some data manipulation during the import.
I am a beginner so I would appreciate your advice on how to do this as well
as article, samples, links etc. that I might be able to learn from. Thank
you.Hi Mike
Check out sqldts.com for lots of information on how to do things using DTS!
The safest option would be if you can make each section a named range then
they could be imported separately. Another option, if all sections have the
same format would be to import the data into a staging table (with an
identity column) and then split it off from there (although I don't know if
the row order will be guaranteed!!!)
John
"Mike" wrote:
> I have an excel spread sheet that contains a header and three different
> sections (delineated by text statements on separate lines between the data).
> Header One Some Data by Name
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> Header Two Some Data by Name
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> Header Three Some Data by Name
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> $23,598.00 $23,598.00 $23,598.00 $23,598.00
> I need to import the data from each section and import it into a different
> SQL 2000 file for each section of the excel spreadsheet. I also need to
> perform some data manipulation during the import.
> I am a beginner so I would appreciate your advice on how to do this as well
> as article, samples, links etc. that I might be able to learn from. Thank
> you.
>
>

Excel to Sql

Hi,
I want to convert excel sheet data to sql database.I have completed it using OLEDB connection and sql query.I retrieved the data from excel and bind the data into dataset using OLEDataAdapter and then dataset content will be displayed on grid.If the excel sheet data is of same datatype means it is working properly.See the excel sheet example...

Name Mark1 Mark2
Ram 87 76
somu 45 65
james 65 98

When converting this excel to sql it is working properly..
See the problem below..

Name Mark1 Mark2
Ram 87 76
somu 45 AB
james 65 98

when i am giving 'AB' to mark it shows null value at that specified column(ie,blank space on grid for the data 'AB').
This is my problem...How can i rectify this...Any alternative solutions...

You need to check your database column's datatype. The problem you are running into is most likely the target column is a numeric column.

Let me know whether you can fix the problem by change the data type of the column, keep the data type consistent in your code too.

|||May i know,the way to convert excel t sqlserver database table|||You can simply use Import/Export Wizard in SQL ServerSmile

Excel to SQl

Hi All

Thnks for the time

I was trying to figure out how to insert the data that I read from an excel sheet into multiple tables in SQL Database 2005.

// Connection string to the excel file

string excelConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +

"Data Source= D:\\UserData.xls;" +

"Extended Properties=Excel 8.0;";

//Command to read data is

SELECT ID,ProductName,ProductDesc,CategoryName FROM [Products$]

//Connection string for sql 2005 database

string sqlConnectionString = "DataSource=MyServer\\MSSQLEXPRESS;Initial Catalog=TestExcel;Integrated Security=True";

And what is your question ?

Jens K. Suessmeyer.

http://www.sqlserver2005.de

Excel to MSSQL

hi

i have an excel sheet with 2 columns
regno name
-- --
and a table regdetails of the form

regdetails
(
regno bigint
name varchar(30)
)

my requirement is to export the data from excel sheet to the table.
the excel sheet may have duplicate entries but i want only distinct
records to be exported to the table.

can i create a DTS package to perform this ?

please post ur commentsYes you can accomplish this with DTS, import to a temp table and delete duplicate rows then copy to original table. May check http://www.sqldts.com website for more information.

Excel to MS SQL

Hai all,
I want to export the data from Excel sheet to SQL database. In the Excel sheet one column contains the date value and non date like 0 and blank. I want to transfer this to my table by changing the format to dd/mm/yyyy.

If I open and format the column to date, and if I export then in the table i am getting different formats ( based on the client machines Date format , The column in the table is Varchar becaust the Excel sheet column will contain date and other non date like 0 , blank etc )

Now how can I export the Excel column that contains date , 0 and blanks to the table in the database with date format dd/mm/yyyy and null for non date values?

Thanks
NarayanaswamyYou should import your data as VARCHAR in a temporary table, and transform it in a second step.|||Hai ,
I tried that also, but the problem is
If In the excel sheet first field is a text or 0 then All thetext values are transfered to the Table but the date fields are transfered as NULL.
If the first row in the excel is Date then All the date are transferred properly and the text and 0 are transfered as NULL.

But the date transfed is of various type ( as per the client machine Date format how can i convert it to same format?)

Can you help me in solving this problem?

Thanks

Narayanaswamy|||Yeah, Excel is great, but not for storing data.

I would take another approach, and would include some VBA code into your workbooks to transform your sheets first into the proper format before exporting them. Your could also consider to export them by VBA.|||Originally posted by Narayanaswamy
Hai ,
I tried that also, but the problem is
If In the excel sheet first field is a text or 0 then All thetext values are transfered to the Table but the date fields are transfered as NULL.
If the first row in the excel is Date then All the date are transferred properly and the text and 0 are transfered as NULL.

But the date transfed is of various type ( as per the client machine Date format how can i convert it to same format?)

Can you help me in solving this problem?

Thanks

Narayanaswamy

I did have the same problem with importing excel data to MSSQL.
After some fighting I just imported data to Access and then to MSSQL.
It was needed to do not often. :)

Excel to Crystal Report

I wish to create a crystal report from an Excel workbook that contains many sheets. Each sheet contains data regarding a one project each. All sheets are of the same format in displaying data. How do I create a crystal report from this workbook, so that the data in the crystal report is displayed as treeview of which the project data itself can be expanded and minimised? Finally this has to be installed in the client's computer. Should I create an addin? You experts out there, please suggest and help me.

ThanksPlease help. No gurus?|||Create a new Report
When selecting Datasource choose the option Access/Excel
Then Choose Database type as Excel
Then Choose name the Excel file
Do the normal procedure thereafter|||Thanks. I will try that.
Thanks|||Did the prior answer to your question help? It seems that you don't need to go from Crystal to Excel but to format a Crystal report to match an Excel spreadsheet. Is that correct?

I have a similar problem. I am trying to convert to Crystal Reports a very complicated Excel worksheet that integrates with a tool that directly pulls data from an Oracle db. With Excel, they "cherry-pick" which accounts they want on any particular row.

In Crystal, you have some control over placing groups and naming them. This approach may work (Group->specified order) but it would be (1) extremely tedious as there are hundreds of lines, (2) I may exceed its capacity, (3) it would be hard for client to support, and (4) it may not work!

Have you found anything that might help?

Thanks!

Excel Sheet name and Sorting Problem...

Hai,
Is it possible to give another name that "Sheet1" when I export my
report to Excel ?
Also
When i make report header it is not allowing me to sort?
Any solutions/Samples ?
Thanks in advance
Aravind.SNot sure about the Sheet1 name, but when you create a report header, make
sure that the end of the header text box lines up with the end of a text box
in your detail.
Hope that helps!
"aravindsabapathy@.gmail.com" wrote:
> Hai,
> Is it possible to give another name that "Sheet1" when I export my
> report to Excel ?
> Also
> When i make report header it is not allowing me to sort?
> Any solutions/Samples ?
> Thanks in advance
> Aravind.S
>

EXcel sheet into database with stored procedure

Hi,

What is the syntax of storing the content of an Excelsheet in a predefined
table
with a stored prcedure.

Arno de Jong, The Netherlands.A.M. de Jong (arnojo@.wxs.nl) writes:
> What is the syntax of storing the content of an Excelsheet in a predefined
> table
> with a stored prcedure.

As I don't use Excel much with SQL Server, I went to http://www.google.com
and entered:

Excel INSERT "SQL Server"

and god a couple of hits. The first one is a blog entry from SQL Server
MVP Dejan Sarka:
http://solidqualitylearning.com/blo.../03/12/441.aspx.

This should get you started.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Friday, February 17, 2012

excel problem

hi I have an excel sheet with no header row.
so I used DTS package to transfer data to the table,
however, transform data task think my first row is the header column,
as the result, I can never transfer my first row data to the table.
is there a way to do this? maybe I have to use activex?
regardsI'm trying to leave work, but
HDR=Yes;IMEX=1
is something I remember about hte header row.
"Kevin" <Kevin@.discussions.microsoft.com> wrote in message
news:AAAA9CB5-206D-4721-B033-09EBD825100F@.microsoft.com...
> hi I have an excel sheet with no header row.
> so I used DTS package to transfer data to the table,
> however, transform data task think my first row is the header column,
> as the result, I can never transfer my first row data to the table.
> is there a way to do this? maybe I have to use activex?
> regards
>|||where do I put this code?
I tried to put the code in activex,
nothing happen. still same problem..
thanks for helping
"sloan" wrote:

> I'm trying to leave work, but
>
> HDR=Yes;IMEX=1
> is something I remember about hte header row.
>
>
>
> "Kevin" <Kevin@.discussions.microsoft.com> wrote in message
> news:AAAA9CB5-206D-4721-B033-09EBD825100F@.microsoft.com...
>
>|||Refer this link
http://www.sqldts.com/default.aspx?254
Regards
Sudarshan Selvaraja
"Kevin" wrote:
> where do I put this code?
> I tried to put the code in activex,
> nothing happen. still same problem..
> thanks for helping
>
> "sloan" wrote:
>

Wednesday, February 15, 2012

Excel ODBC Problem

Hello,

I created an excel sheet I want to link to, to get data from. But now I'm at a loss as to how to actually make this sheet work in Crystal. Help!

I know I have to set up a new ODBC connection for the spreadsheet I created, which I did.

When I select the spreadsheet as a new connection, it comes up with a blank table (no fields).

What did I do wrong?create a new connection in crystal using
access/excel DAO|||This link may help

http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2001842&sliceId=&dialogID=3630043&stateId=1%200%203628127

Rashmi

Excel into Temp table and validations in SSIS

i have an excel sheet with about 30 columns of data ...i want to validate all the data in these cells of the excel through SSIS.
I want to get this data to a temporary table before running my validation stored proc...how do i get this data from the excel to the temp table , this temp table should accept all the data from the excel file in whatever form it is there should be no rows that get discarded while filling this table from the excel.
Moreever how do i get the column header data if the first row in the excel contains Column names how do i get these names and validate them if they are conferring to a
set of names.

Excel sheet ::

ColName1 ColName 2 ........ColName30

ColData11 ColData12..........ColData130

.....
..... ..... .. ...
..... ..... .. ...
Temp table ::

ColName1 ColName2 .. ...... ColName30 IsValid Description


Also can i do validations like Datatype and Length directly in SSIS ? or do i need to do it with a stored proc
Please Help....

Thanks
Clayton

Hi,

In SSIS, when you are transferring data from one Excel File to Another File you have to create an Excel Connection Manager for Source and Destination and in that you have an option as "First Row has Column Names".

But I am not sure about the validation at this point of time. Will verify and let you know that.

Thanks,

Prakash Srinivasan

Excel into Temp table and validations in SSIS

i have an excel sheet with about 30 columns of data ...i want to validate all the data in these cells of the excel through SSIS.
I want to get this data to a temporary table before running my validation stored proc...how do i get this data from the excel to the temp table , this temp table should accept all the data from the excel file in whatever form it is there should be no rows that get discarded while filling this table from the excel.
Moreever how do i get the column header data if the first row in the excel contains Column names how do i get these names and validate them if they are conferring to a
set of names.

Excel sheet ::

ColName1 ColName 2 ........ColName30

ColData11 ColData12..........ColData130

.....
..... ..... .. ...
..... ..... .. ...
Temp table ::

ColName1 ColName2 .. ...... ColName30 IsValid Description


Also can i do validations like Datatype and Length directly in SSIS ? or do i need to do it with a stored proc
Please Help....

Thanks
Clayton

Hi,

In SSIS, when you are transferring data from one Excel File to Another File you have to create an Excel Connection Manager for Source and Destination and in that you have an option as "First Row has Column Names".

But I am not sure about the validation at this point of time. Will verify and let you know that.

Thanks,

Prakash Srinivasan

Excel Import to sqlserver database

Hi all,

this is thiru from India, hope i shall get answers here for my questions.

1. I need to import an Excel spread sheet to a remote sql server database through ASP.Net web application. I brief the process im following now please go through it.

Import Process:

a. select a fiile(.xls) and upload it to server.
b. using M/S Odbc Excel driver, and the uploaded excel file as datasource,
c. query the excel sheet to populate a dataset.
d. iterate through the rows of the dataset(I could not bulk copy the excel data, because
have to check the database, if record exists then update, else insert) to import to the
SQL Database

Performance issues:
1. I have to import spreadsheets having upto 60,000 records or even more at a time.
2. Is this a good option to use a webapplication for this task (I use this approach because
my boss wants to do so).
3. some times the excel file size grows up to 7 mb(Though i shall adjust config settings,
uploading and then querying a 7 mb file shall be an ovverhead i think.)
4. is there any possibility to get the datasource with out uploading the file to the server (Like
modifying the connection string as "datasource=HtmlFileControl.PostedFile" instead,)(I
tried this but it gives me "unspecified error").

please analyse my problem and suggest me a possible solution.
I thank all, for your efforts, of any kind.
have a nice time,
........thiru

hi,

you can directly import excel

to sql server import table

do the processing from the import table

to the staging table.

then from the staging table load it directly to the destination table.

i suggest you use SSIS or DTS or you can linked server

to excell and do the processing with sql server.

the problem with your approach is that you might encounter a dataset limitation.

there is no restartability feature. if your application breaks in the middle of the load process

where half of the data has been loaded it would be a great nightmare.

the first above mentioned approach is used widely in BI and datawarehousing.

here's some explanation on how it works:

1. you import the data to an import table. the import table shall be used

for processing the data .this liberates the datasource from heavy processing

and migrates the proceessing to SQL. if the import fails you can truncate the import table

and re import the data. this can done easily without harming the production.

the idea here is to first load everything into sql server.

2. stage the data to the staging table from the imports. here you do data cleansing

the burden nows reside on the sql server which is not a burden at all but a big problem to asp

from your previous design. Resatrtability. truncate the stage table and do the processing from either

step 1 or 2.

3. bulk insert from the stage to the production table. here your very sure that you are inserting a very clean data

with great speed.

|||Hello,
Thanls for your efforts, I have proceeded a long way through the application and my most recent challenge is this:

please let me find some help.

For a couple of weeks i am struggling with an excel import and export application to sqlserver as i have to do it through an external application and not through the Export Import Utility in sql server.
My most recent problem is:
The understanding of field values by sql server and excel.
1. I need to import into a table whose fields are varchar type.
2. I have to use as datasource- an Excel sheet(.xls file).
3. Some fields in excel contain numbers (Length up to 10 or
more digits).
4. For this I first format the cells'(in Excel file) datatype
into "Text".
5. Even then after importing into a table(say tblTemp) whose
schema/structure, is

CREATE TABLE [tblTemp] (
[rowId] int IDENTITY(1,1),
[Account Number] varchar(30) not null ,
[Mobile Number] varchar(30) null,
[Name] varchar(100) null
)
, and to import into this table im using select into query
with datasource as the excel file(Data Source=ExcelFile.xls),
the table fields show exponential values(may be float
datatype).
Shall any one suggest me how shall i get values from excel sheet with datatype varchar and import into the above said table as varchar values (with out any exponential types).|||

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

|||

David Hayden wrote:

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

I noticed that the codings are in C#.... is there any codings examples doing the same process using VB?

|||

hi thiru

how r u ?

iam facing same problem if have solution please suggest me

thanking u

with regards

purushotham.T

|||The easiest way I found of importing data from an excel sheet to sql server is saving the sheet as a tab delimited text file and then importing it to sql server. View this microsof issue :http://support.microsoft.com/kb/236605
Hope this helps

Excel Import to sqlserver database

Hi all,

this is thiru from India, hope i shall get answers here for my questions.

1. I need to import an Excel spread sheet to a remote sql server database through ASP.Net web application. I brief the process im following now please go through it.

Import Process:

a. select a fiile(.xls) and upload it to server.
b. using M/S Odbc Excel driver, and the uploaded excel file as datasource,
c. query the excel sheet to populate a dataset.
d. iterate through the rows of the dataset(I could not bulk copy the excel data, because
have to check the database, if record exists then update, else insert) to import to the
SQL Database

Performance issues:
1. I have to import spreadsheets having upto 60,000 records or even more at a time.
2. Is this a good option to use a webapplication for this task (I use this approach because
my boss wants to do so).
3. some times the excel file size grows up to 7 mb(Though i shall adjust config settings,
uploading and then querying a 7 mb file shall be an ovverhead i think.)
4. is there any possibility to get the datasource with out uploading the file to the server (Like
modifying the connection string as "datasource=HtmlFileControl.PostedFile" instead,)(I
tried this but it gives me "unspecified error").

please analyse my problem and suggest me a possible solution.
I thank all, for your efforts, of any kind.
have a nice time,
........thiru

hi,

you can directly import excel

to sql server import table

do the processing from the import table

to the staging table.

then from the staging table load it directly to the destination table.

i suggest you use SSIS or DTS or you can linked server

to excell and do the processing with sql server.

the problem with your approach is that you might encounter a dataset limitation.

there is no restartability feature. if your application breaks in the middle of the load process

where half of the data has been loaded it would be a great nightmare.

the first above mentioned approach is used widely in BI and datawarehousing.

here's some explanation on how it works:

1. you import the data to an import table. the import table shall be used

for processing the data .this liberates the datasource from heavy processing

and migrates the proceessing to SQL. if the import fails you can truncate the import table

and re import the data. this can done easily without harming the production.

the idea here is to first load everything into sql server.

2. stage the data to the staging table from the imports. here you do data cleansing

the burden nows reside on the sql server which is not a burden at all but a big problem to asp

from your previous design. Resatrtability. truncate the stage table and do the processing from either

step 1 or 2.

3. bulk insert from the stage to the production table. here your very sure that you are inserting a very clean data

with great speed.

|||

Hello,
Thanls for your efforts, I have proceeded a long way through the application and my most recent challenge is this:

please let me find some help.

For

a couple of weeks i am struggling with an excel import and export

application to sqlserver as i have to do it through an external

application and not through the Export Import Utility in sql server.
My most recent problem is:
The understanding of field values by sql server and excel.
1. I need to import into a table whose fields are varchar type.
2. I have to use as datasource- an Excel sheet(.xls file).
3. Some fields in excel contain numbers (Length up to 10 or
more digits).
4. For this I first format the cells'(in Excel file) datatype
into "Text".
5. Even then after importing into a table(say tblTemp) whose
schema/structure, is

CREATE TABLE [tblTemp] (
[rowId] int IDENTITY(1,1),
[Account Number] varchar(30) not null ,
[Mobile Number] varchar(30) null,
[Name] varchar(100) null
)
, and to import into this table im using select into query
with datasource as the excel file(Data Source=ExcelFile.xls),
the table fields show exponential values(may be float
datatype).
Shall

any one suggest me how shall i get values from excel sheet with

datatype varchar and import into the above said table as varchar values

(with out any exponential types).|||

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

|||

David Hayden wrote:

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

I noticed that the codings are in C#.... is there any codings examples doing the same process using VB?

|||

hi thiru

how r u ?

iam facing same problem if have solution please suggest me

thanking u

with regards

purushotham.T

|||The easiest way I found of importing data from an excel sheet to sql server is saving the sheet as a tab delimited text file and then importing it to sql server. View this microsof issue :http://support.microsoft.com/kb/236605
Hope this helps

Excel Import to sqlserver database

Hi all,

this is thiru from India, hope i shall get answers here for my questions.

1. I need to import an Excel spread sheet to a remote sql server database through ASP.Net web application. I brief the process im following now please go through it.

Import Process:

a. select a fiile(.xls) and upload it to server.
b. using M/S Odbc Excel driver, and the uploaded excel file as datasource,
c. query the excel sheet to populate a dataset.
d. iterate through the rows of the dataset(I could not bulk copy the excel data, because
have to check the database, if record exists then update, else insert) to import to the
SQL Database

Performance issues:
1. I have to import spreadsheets having upto 60,000 records or even more at a time.
2. Is this a good option to use a webapplication for this task (I use this approach because
my boss wants to do so).
3. some times the excel file size grows up to 7 mb(Though i shall adjust config settings,
uploading and then querying a 7 mb file shall be an ovverhead i think.)
4. is there any possibility to get the datasource with out uploading the file to the server (Like
modifying the connection string as "datasource=HtmlFileControl.PostedFile" instead,)(I
tried this but it gives me "unspecified error").

please analyse my problem and suggest me a possible solution.
I thank all, for your efforts, of any kind.
have a nice time,
........thiru

hi,

you can directly import excel

to sql server import table

do the processing from the import table

to the staging table.

then from the staging table load it directly to the destination table.

i suggest you use SSIS or DTS or you can linked server

to excell and do the processing with sql server.

the problem with your approach is that you might encounter a dataset limitation.

there is no restartability feature. if your application breaks in the middle of the load process

where half of the data has been loaded it would be a great nightmare.

the first above mentioned approach is used widely in BI and datawarehousing.

here's some explanation on how it works:

1. you import the data to an import table. the import table shall be used

for processing the data .this liberates the datasource from heavy processing

and migrates the proceessing to SQL. if the import fails you can truncate the import table

and re import the data. this can done easily without harming the production.

the idea here is to first load everything into sql server.

2. stage the data to the staging table from the imports. here you do data cleansing

the burden nows reside on the sql server which is not a burden at all but a big problem to asp

from your previous design. Resatrtability. truncate the stage table and do the processing from either

step 1 or 2.

3. bulk insert from the stage to the production table. here your very sure that you are inserting a very clean data

with great speed.

|||Hello,
Thanls for your efforts, I have proceeded a long way through the application and my most recent challenge is this:

please let me find some help.

For a couple of weeks i am struggling with an excel import and export application to sqlserver as i have to do it through an external application and not through the Export Import Utility in sql server.
My most recent problem is:
The understanding of field values by sql server and excel.
1. I need to import into a table whose fields are varchar type.
2. I have to use as datasource- an Excel sheet(.xls file).
3. Some fields in excel contain numbers (Length up to 10 or
more digits).
4. For this I first format the cells'(in Excel file) datatype
into "Text".
5. Even then after importing into a table(say tblTemp) whose
schema/structure, is

CREATE TABLE [tblTemp] (
[rowId] int IDENTITY(1,1),
[Account Number] varchar(30) not null ,
[Mobile Number] varchar(30) null,
[Name] varchar(100) null
)
, and to import into this table im using select into query
with datasource as the excel file(Data Source=ExcelFile.xls),
the table fields show exponential values(may be float
datatype).
Shall any one suggest me how shall i get values from excel sheet with datatype varchar and import into the above said table as varchar values (with out any exponential types).|||

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

|||

David Hayden wrote:

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

I noticed that the codings are in C#.... is there any codings examples doing the same process using VB?

|||

hi thiru

how r u ?

iam facing same problem if have solution please suggest me

thanking u

with regards

purushotham.T

|||The easiest way I found of importing data from an excel sheet to sql server is saving the sheet as a tab delimited text file and then importing it to sql server. View this microsof issue :http://support.microsoft.com/kb/236605
Hope this helps

Excel Import to sqlserver database

Hi all,

this is thiru from India, hope i shall get answers here for my questions.

1. I need to import an Excel spread sheet to a remote sql server database through ASP.Net web application. I brief the process im following now please go through it.

Import Process:

a. select a fiile(.xls) and upload it to server.
b. using M/S Odbc Excel driver, and the uploaded excel file as datasource,
c. query the excel sheet to populate a dataset.
d. iterate through the rows of the dataset(I could not bulk copy the excel data, because
have to check the database, if record exists then update, else insert) to import to the
SQL Database

Performance issues:
1. I have to import spreadsheets having upto 60,000 records or even more at a time.
2. Is this a good option to use a webapplication for this task (I use this approach because
my boss wants to do so).
3. some times the excel file size grows up to 7 mb(Though i shall adjust config settings,
uploading and then querying a 7 mb file shall be an ovverhead i think.)
4. is there any possibility to get the datasource with out uploading the file to the server (Like
modifying the connection string as "datasource=HtmlFileControl.PostedFile" instead,)(I
tried this but it gives me "unspecified error").

please analyse my problem and suggest me a possible solution.
I thank all, for your efforts, of any kind.
have a nice time,
........thiru

hi,

you can directly import excel

to sql server import table

do the processing from the import table

to the staging table.

then from the staging table load it directly to the destination table.

i suggest you use SSIS or DTS or you can linked server

to excell and do the processing with sql server.

the problem with your approach is that you might encounter a dataset limitation.

there is no restartability feature. if your application breaks in the middle of the load process

where half of the data has been loaded it would be a great nightmare.

the first above mentioned approach is used widely in BI and datawarehousing.

here's some explanation on how it works:

1. you import the data to an import table. the import table shall be used

for processing the data .this liberates the datasource from heavy processing

and migrates the proceessing to SQL. if the import fails you can truncate the import table

and re import the data. this can done easily without harming the production.

the idea here is to first load everything into sql server.

2. stage the data to the staging table from the imports. here you do data cleansing

the burden nows reside on the sql server which is not a burden at all but a big problem to asp

from your previous design. Resatrtability. truncate the stage table and do the processing from either

step 1 or 2.

3. bulk insert from the stage to the production table. here your very sure that you are inserting a very clean data

with great speed.

|||Hello,
Thanls for your efforts, I have proceeded a long way through the application and my most recent challenge is this:

please let me find some help.

For a couple of weeks i am struggling with an excel import and export application to sqlserver as i have to do it through an external application and not through the Export Import Utility in sql server.
My most recent problem is:
The understanding of field values by sql server and excel.
1. I need to import into a table whose fields are varchar type.
2. I have to use as datasource- an Excel sheet(.xls file).
3. Some fields in excel contain numbers (Length up to 10 or
more digits).
4. For this I first format the cells'(in Excel file) datatype
into "Text".
5. Even then after importing into a table(say tblTemp) whose
schema/structure, is

CREATE TABLE [tblTemp] (
[rowId] int IDENTITY(1,1),
[Account Number] varchar(30) not null ,
[Mobile Number] varchar(30) null,
[Name] varchar(100) null
)
, and to import into this table im using select into query
with datasource as the excel file(Data Source=ExcelFile.xls),
the table fields show exponential values(may be float
datatype).
Shall any one suggest me how shall i get values from excel sheet with datatype varchar and import into the above said table as varchar values (with out any exponential types).|||

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

|||

David Hayden wrote:

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

I noticed that the codings are in C#.... is there any codings examples doing the same process using VB?

|||

hi thiru

how r u ?

iam facing same problem if have solution please suggest me

thanking u

with regards

purushotham.T

|||The easiest way I found of importing data from an excel sheet to sql server is saving the sheet as a tab delimited text file and then importing it to sql server. View this microsof issue :http://support.microsoft.com/kb/236605
Hope this helps

Excel Import to sqlserver database

Hi all,

this is thiru from India, hope i shall get answers here for my questions.

1. I need to import an Excel spread sheet to a remote sql server database through ASP.Net web application. I brief the process im following now please go through it.

Import Process:

a. select a fiile(.xls) and upload it to server.
b. using M/S Odbc Excel driver, and the uploaded excel file as datasource,
c. query the excel sheet to populate a dataset.
d. iterate through the rows of the dataset(I could not bulk copy the excel data, because
have to check the database, if record exists then update, else insert) to import to the
SQL Database

Performance issues:
1. I have to import spreadsheets having upto 60,000 records or even more at a time.
2. Is this a good option to use a webapplication for this task (I use this approach because
my boss wants to do so).
3. some times the excel file size grows up to 7 mb(Though i shall adjust config settings,
uploading and then querying a 7 mb file shall be an ovverhead i think.)
4. is there any possibility to get the datasource with out uploading the file to the server (Like
modifying the connection string as "datasource=HtmlFileControl.PostedFile" instead,)(I
tried this but it gives me "unspecified error").

please analyse my problem and suggest me a possible solution.
I thank all, for your efforts, of any kind.
have a nice time,
........thiru

hi,

you can directly import excel

to sql server import table

do the processing from the import table

to the staging table.

then from the staging table load it directly to the destination table.

i suggest you use SSIS or DTS or you can linked server

to excell and do the processing with sql server.

the problem with your approach is that you might encounter a dataset limitation.

there is no restartability feature. if your application breaks in the middle of the load process

where half of the data has been loaded it would be a great nightmare.

the first above mentioned approach is used widely in BI and datawarehousing.

here's some explanation on how it works:

1. you import the data to an import table. the import table shall be used

for processing the data .this liberates the datasource from heavy processing

and migrates the proceessing to SQL. if the import fails you can truncate the import table

and re import the data. this can done easily without harming the production.

the idea here is to first load everything into sql server.

2. stage the data to the staging table from the imports. here you do data cleansing

the burden nows reside on the sql server which is not a burden at all but a big problem to asp

from your previous design. Resatrtability. truncate the stage table and do the processing from either

step 1 or 2.

3. bulk insert from the stage to the production table. here your very sure that you are inserting a very clean data

with great speed.

|||

Hello,
Thanls for your efforts, I have proceeded a long way through the application and my most recent challenge is this:

please let me find some help.

For

a couple of weeks i am struggling with an excel import and export

application to sqlserver as i have to do it through an external

application and not through the Export Import Utility in sql server.
My most recent problem is:
The understanding of field values by sql server and excel.
1. I need to import into a table whose fields are varchar type.
2. I have to use as datasource- an Excel sheet(.xls file).
3. Some fields in excel contain numbers (Length up to 10 or
more digits).
4. For this I first format the cells'(in Excel file) datatype
into "Text".
5. Even then after importing into a table(say tblTemp) whose
schema/structure, is

CREATE TABLE [tblTemp] (
[rowId] int IDENTITY(1,1),
[Account Number] varchar(30) not null ,
[Mobile Number] varchar(30) null,
[Name] varchar(100) null
)
, and to import into this table im using select into query
with datasource as the excel file(Data Source=ExcelFile.xls),
the table fields show exponential values(may be float
datatype).
Shall

any one suggest me how shall i get values from excel sheet with

datatype varchar and import into the above said table as varchar values

(with out any exponential types).|||

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

|||

David Hayden wrote:

I recommend just uploading the sheet to a staging table in SQL Server as mentioned by the previous person. You can use SqlBulkCopy to pull this off as mentioned in the following tutorial:

Import / Export Excel Spreadsheet Data into SQL Server Database Table Using SqlBulkCopy

Here are some other tutorials that may be of interest:

Reading and Writing Excel Spreadsheets / Worksheets Using ADO.NET C# DbProviderFactory

Reading Excel Worksheet and Column Schema Information Using ADO.NET 2.0 and GetSchema

The spreadsheet has a schema and you want to make sure it is formatted properly.

Regards,

Dave

I noticed that the codings are in C#.... is there any codings examples doing the same process using VB?

|||

hi thiru

how r u ?

iam facing same problem if have solution please suggest me

thanking u

with regards

purushotham.T

|||The easiest way I found of importing data from an excel sheet to sql server is saving the sheet as a tab delimited text file and then importing it to sql server. View this microsof issue :http://support.microsoft.com/kb/236605
Hope this helps