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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-10-02 : 07:32:15
|
| abe writes "hi...how to import text file to sql server db using aspsample data :-this is a text fileHCOMPANY NAME HOLDING0000000001000.5502C12345D780110-03-55550000000000500.00C12345D780110-03-44440000000000500.55C12345import to 2 sql dbdb1 - line 1 (first character is H) for headerresult : COMPANY NAME HOLDING,1000.55,02,cC12345db2 - line 2 and 3 (first character is D) for detailresult : 780110-03-5555,500.00,C12345780110-03-4444,500.55,C12345pls help me..Thank's" |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-10-02 : 12:55:42
|
| Why not use DTS or bcp for this? These allow you to do this very easily.Tara |
 |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2003-10-03 : 14:44:04
|
| create table ##mytbl (s varchar(8000))BULK INSERT ##mytbl from 'c:\myfile.txt' with (FIELDTERMINATOR='|')select * from ##mytbl ==========================================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. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2003-10-03 : 15:11:36
|
| This is the whole header and trailer thing again....Load the whole thing in to 1 varchar(8000) column and use SUBSTRING to interogate the data and the move it in to your final table...Brett8-)SELECT @@POST FROM Brain ORDER BY NewId()That's correct! It's an AlphaNumeric! |
 |
|
|
Mits
Starting Member
48 Posts |
Posted - 2003-10-06 : 07:02:37
|
| hi nr,I have the similar kind of application. In my case i have the text file delimited by comma and also the table with Field name. how do i use bulk insert in my vb application.thanksMits |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-10-06 : 12:35:38
|
| Mits, when you use bulk insert command, the file must be on the SQL Server. Information about bulk insert can be found in SQL Server Books Online.Tara |
 |
|
|
|
|
|