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 Development (2000)
 importing a text file into a table

Author  Topic 

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-09-15 : 02:19:36
i tried to import a text file to sql server
this is the file :
http://www.planetnana.co.il/pelegkurland/wg140906.txt
the strange thingthat i got only half of the rows!!!
when i checked it closer i saw that it has imported 1 line and the next line not!!!
how can this happen?maybe some char make this problem so i can import all the lines?maybe some char makes sql server to think that its endofline from its starts?
thnaks in advance
peleg

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-15 : 02:22:19
How do you import the text file ? BCP ? DTS ?


KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-15 : 02:24:03
Which meyhod did you use for importing the textfile?
If possible, try to set FIRSTROW = 2 in the code you have.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-09-15 : 02:31:28
i am doing
right click o nthe DB->import data and then choose import file
i can delete the first line if i makes a problem!

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-15 : 02:36:21
Yes. The first line contains information about the file, created and so one.
From Line 2 and to the end of file, all rows looks the same.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-09-15 : 02:44:19
i deleted the first line and like a miracle it worked!!!
still i dont get where is the diffrence!
mysterious are the ways of god.....

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-15 : 02:53:22
"right click o nthe DB->import data and then choose import file"
That's DTS. You can also specify number of rows to skip in one of the DTS screen.


KH

Go to Top of Page

pelegk2
Aged Yak Warrior

723 Posts

Posted - 2006-09-15 : 02:54:13
ow ok but still i cant understand how the first row massed it all up

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-09-15 : 03:00:45
quote:
Originally posted by pelegk2

ow ok but still i cant understand how the first row massed it all up

Israel -the best place to live in aftr heaven 9but no one wan't to go there so fast -:)


Can't tell from here . Most probably is the settings you specify while importing the text file. Maybe delimited vs fixed field ? Row delimiter ?


KH

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-15 : 03:27:30
First three rows in the text file in link above
00,WG256T01.PRN,WF ,060913,03715,183583,91943912
0310879110108500082006091020070909
0310897110108400102006091020070909


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-09-15 : 03:28:21
I think you can check "Ignore first row" or "Skip first row" when importing through EM and DTS, I am not sure.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -