Showing posts with label situation. Show all posts
Showing posts with label situation. Show all posts

Friday, March 30, 2012

Import partial Sql table from Excel spreadsheet

I have this situation that I need to read a spreadsheet with user names into a sql table where user name is just one of the columns. I tried using oledb connection to read the spreadsheet and sqlbulkcopy to import into sql table. There was no error, but the data wasn't imported into sql.

Does anyone have any suggestion what I did wrong or what is the right way of doing this?

Thanks a lot.

Mia

Try the thread below for all you need, post again if you still have question. Hope this helps.

http://forums.asp.net/thread/1442470.aspx

|||Thank you. I will take a look at the posts/articles and let you know.

Wednesday, March 28, 2012

Import multiple csv into multiple tables

Is there a way to import multiple csv files from a directory into sql
2005? The situation I have right now is that I have a folder with
multiple csv files that i need to import into sql 2005. I can do it
with the import wizard but it takes to long. The files will be updated
monthly. The first row in the files contains all the header information
which may change monthy. What I am looking to do is import all of these
csv into tables. One csv file into for one table. Ideally I would like
to use the name of the csv file as the name of the table. Any bump in
the right direction would be apprecietedChicagoboy27 (jeremy.bird@.gmail.com) writes:

Quote:

Originally Posted by

Is there a way to import multiple csv files from a directory into sql
2005? The situation I have right now is that I have a folder with
multiple csv files that i need to import into sql 2005. I can do it
with the import wizard but it takes to long. The files will be updated
monthly. The first row in the files contains all the header information
which may change monthy. What I am looking to do is import all of these
csv into tables. One csv file into for one table. Ideally I would like
to use the name of the csv file as the name of the table. Any bump in
the right direction would be apprecieted


You could use BCP or BULK INSERT, but it appears that you would have to
add quite some control code on top that.

A better alternative could be to turn to SQL Server Integration Services,
which is what the Import Wizard uses. Unfortunately, though, I am
completely unexperienced myself with SSIS, so I cannot assist further.

--
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, March 9, 2012

Import data from diferent vendors

Hello,

I have this kind of situation: I have Oracle database from an old application and i have to maje an job to copy it every day into an SQL Server 2005 database. The data should stay in both databases. Is this posible to do it with an job or i have to develop an service? If it is possibe i would like to know how. Is the same possible but from DB2 database to SQL Server 2005 database?

Thanks

Yes its possible. there are many method

(a) Create a linkedserver to Oracledatabase and copy the data : Read Linkedserver In BOL(Books online)

(b) Create a SSIS (Integration Service) package to migrate the data.

(c) Openddatasource

alll these can be scheduled though a job

Madhu

|||

can same be done with DB2 database instead of oracle?

|||

yes it can be done. only the provider changes..

Madhu

Wednesday, March 7, 2012

import CSV data to SQL Server database

Hello everyone,

I need help with a situation that iam facing right now.

Here is the problem:

I have a tab limited or comma delimited CSV file. I want to read the contents of that CSV file and import it in one of the tables in the database.

id firstname lastname
-- ---- ----
"1" "John" "Smith"
"2" "Louis" "Garcia"

I assume that the columns in the CSV files and the table in the database match the datatype.

What would be a good approach to do it ? If anyone have a code that does the job, please post it.

Thank You.Do you have Enterprise Manager? If so goto the "import data" menu.|||Or Use a Bulk Insert statement

BULK INSERT dbo.TableName FROM '\\yourMachine\filename.csv'
WITH (DATAFILETYPE = 'char',
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n',
FIRSTROW = 2 )|||Hi pkr,

I want to achieve this programatically using ASP.Net and VB.Net .....

Can you tell me any good resources on it please ?

Thank You.|||Hi John,

Do you have a code snippet in ASP.Net/VB.Net that shows how to use the bulk statement ??

Please help.

Thank You.|||Its just like any other SQL statement|||The Bulk insert statement is best kept to the confines of a Stored procedure and therefore you would make a call to the stored proc from your Data Access Layer within your asp.net application.

If your going to use a DTS package you can call this directly from the DAL and manage each step programmatically; if this is the path you want to take I have posted some c# code in the following post:

http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=697176

But i don't recommend it.

All the best, John|||thanks a lot John. it really helped me .