Describe how bcp command prompt utility is used to import and export data.
The bcp utility is accessed from the command prompt.
Syntax:bcp {dbtable | query} {in | out | queryout | format} datafile [-n native type] [-c character type] [-S server name] [-U username] [-P password] [-T trusted connection]
It starts with specifying the database or object name. In and out means whether the data needs to be copied into or out of the database. Hence in will be used for importing data while out will be used to export data. Remaining arguments are the basic command line arguments.
Example1: import data of Company database to the employee table
bcp Company.dbo.employee in c:\temp\employee.bcp -c -Sstevenw -Usa –P
Example2: Export data of Company database from the employee table
bcp Company.dbo.employee out c:\temp\employee.bcp