Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 import .csv file

Author  Topic 

jung1975
Aged Yak Warrior

503 Posts

Posted - 2004-08-13 : 13:44:30
What is the best way to import .csv file witch has 200,000 records?
I can open it up in excel, but it shows only 65,536 records.

Can someone tell me the steps to import .csv file into SQL server?




tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-13 : 13:50:53
Why do you need to open it up in Excel? Just import the csv using DTS. csvs do not have a 65,536 limit. I believe that limit is with Excel. But you don't have to use Excel to open a csv file. Any text editor would open it up. But why bother? Just import it, then view the data in SQL Server.

Tara
Go to Top of Page

kselvia
Aged Yak Warrior

526 Posts

Posted - 2004-08-13 : 19:04:04
In addition to DTS you can also use BULK INSERT:

BULK INSERT dbname.dbo.tablename FROM 'c:\path\file.csv'
with (FIELDTERMINATOR = ',',ROWTERMINATOR = '\n' , TABLOCK)

--Ken
"Knowledge is a process of piling up facts; wisdom lies in their simplification."
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-08-14 : 12:10:58
Excel has that limit because that's the maximum number of rows per worksheet. You could also use bcp, which you can read all about in Books Online.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -