|
|
|
|
Required
BCP
Syntax Arguments
|
Syntax Element |
Description |
|
dbtable |
If you will be importing or exporting
data from a SQL Table or View, this is
the qualified object name.
|
|
|
The bcp
command allows you to tell it which SQL
Server instance to connect to, but does
not allow you to specify which database.
If the table you wish to work with is
not in the connections default database,
you will need to qualify the object name
using the database.schema.object format. |
|
|
If you will be importing to a view, you
need to make sure that the view supports
inserts. |
|
|
dbtable can be used with the in, out, or
format options. This means that you can
import to the table (in) or export from
it (out). |
|
query |
You can export from a query rather than
a specific table or view. You need to
enclose the query in double quotes (")
and use single quotes for any character
literals inside the query. |
|
|
query can be used with the queryout and
format options. You
cannot
import to a query. |
|
in |
Use this option when you will be
importing data into the dbtable
specified. |
|
out |
Use this option when you will be
exporting data from the dbtable
specified. |
|
queryout |
Use this option when you will be
exporting data from the specified query. |
|
format |
Use this option to generate a format
file.
When format is used, no import or export
is performed. Use this option with the
–f and or –x parameters to specify the
path of the generated format
file. We will discuss format
files later. |
|
datafile |
The path of the data
file that you will be importing
from or exporting to. |
|
Optional arguments |
There are number of additional arguments
that can be used with the
BCP utility. They are optional
overall, but certain options may be
required depending on what kind of
operation you are performing. For
example, if you use the format argument
to generate a format
file,
you must also use the –f argument to
specify the path of the
file. |
|
|
|
|
|
|