bcp and the last row

Last Post 07 Mar 2008 06:35 PM by nosepicker. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
HarryNejad
New Member
New Member

--
07 Mar 2008 03:35 PM

I can use the -F parameter to skip the first row.

I can also use the -L parameter to specify the number of the last row to transfer, but to that end I need to know the total number of records in the flat file.

But I do not know the number of records in the flat file.

And if I use negative one (-L-1) it gives me an error to the effect that the negative numbers are not allowed.

So, what can I do to skip the last row?

thanks,

nosepicker
New Member
New Member

--
07 Mar 2008 06:35 PM
No direct way that I know of. Unfortunately, bcp can't do everything. What I would do is use the method I mentioned in the previous topic about using line numbers. Import the data into a staging table, clean out the records you don't want, export the data to a text file, and then import it again into your destination table. A bit hacky yes, but it can work.
You are not authorized to post a reply.

Acceptable Use Policy