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.
| Author |
Topic |
|
sbushway
Starting Member
18 Posts |
Posted - 2003-12-01 : 10:27:25
|
Hi,I have a program that reads about 7000 records from a flatfile and inserts them into a SQL Server 2000 table. This takes about 2.5 minutes (using VB.NET). I was told that a Bulk Insert would be much faster.All the examples I've seen have a FIELDTERMINATOR - I don't have any FIELDTERMINATORs in my file. It's a fixed-width flatfile.example:JOE JONES ATLANTA GAROBERT SMITH TALLAHASSEE FLNATALIE WILLIAMMIAMI FL Can you do a bulk insert with a fixed-width file?Any help would be appreciated!Thanks in advance,Suzanne |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-12-01 : 14:31:23
|
| Yes...but it doesn't look fixed width...could be sql team removing white space...You need to use a format file...you can also use bcp to import the dataDo you have sql server client tools installed?What version of sql server?Brett8-) |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-12-02 : 00:44:40
|
| For 7000 recs I would expect this to take a few seconds.As it is tiny I would import into a single column global temp table then move to the production table - allows for a lot of flexibility.seehttp://www.nigelrivett.net/ImportTextFiles.html==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
sbushway
Starting Member
18 Posts |
Posted - 2003-12-02 : 07:22:22
|
| Hi Brett,Sorry if the output doesn't look fixed-width - I mean for it to be, though. Just use your imagination :)I've been reading up on format files, and I was wondering if that was the direction that I needed to take.Yep, I've got Client Tools on my machine, and I'm using SQL Server 2000.Thanks for your time!Suzanne |
 |
|
|
|
|
|