In reading the answers for this question about the caution against using FIRSTROW as a means of skipping column header rows, it struck me that it seems really inefficient and non-intuitive that a command for skipping rows even parses field terminators in the skipped rows rather than just ignoring them and looking for the row terminators to count skipped rows. But I don't really see other questions reaching the same conclusion, so I must be missing something. Which brings me to the question in the subject - why did the designers of T-SQL choose to implement that feature in that way? What problem does it solve or avoid that doing it in (in my opinion) the more obvious way of counting row terminators would not?

In short, what are the advantages of counting fields rather than rows when skipping rows?

  • 1
    In short, performance. Bulk insert is optimized to parse fields as they are read from the stream. – Dan Guzman Jun 15 at 18:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.