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
 General SQL Server Forums
 New to SQL Server Programming
 BCP

Author  Topic 

avmreddy17
Posting Yak Master

180 Posts

Posted - 2006-06-11 : 10:40:20
I have to import a text file with the header and footer in the text file with x number of rows

Ex

Header
1
2
3
Footer

While BCP in , I am specifying the -F 2 , -L 4 , but for some reason it inserts only two rows into the table.

Is this the BUG in BCP

Thx
Venu

nr
SQLTeam MVY

12543 Posts

Posted - 2006-06-11 : 10:48:49
You are specifying first row = 2 and last row = 4 so I would expect 3 rows.
When I try it that's what I get. Maybe there's something wrong with your file.

try this

header
234
1234
12355
footer

save as c:\bcp.txt
create table a (s varchar(20))

exec master..xp_cmdshell 'bcp tempdb..a in c:\bcp.txt -c -F2 -L4'
select * from a
delete a


==========================================
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.
Go to Top of Page
   

- Advertisement -