usage of BCP and BULK INSERT

  • as I'm not clear how to use bcp and bulk insert in the following cases, could you please give me an example on how to use it ? thanks!

    1. while exporting data using bcp from a table, how to use where condition to export part of data of the table ?
    2. while importing data using bcp from a table, how to use where condition to import part of data of the table ?
    3. can we use bulk insert  to import data from a table ?
  • 1 use a query to extract the pieces you need, look at the QUERYOUT option of BCP for this.

    2 there is no QUERYIN option, so if you only wanted to load part of the file you would have to import it all to a staging table first, then use a query to pull out the pieces you need and store them in the right table

    3 lookup the syntax for BULK INSERT there is examples in the documentation on how to load a file using BULK INSERT

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply