|

|
|
Cry How to...
Import Data from a Comma Separated File
To import data from a comma separated file (csv), use bcp:
bcp [<database-name.>][<owner.>]<table-name> in <csv-file>
[/U<username>] [/P<password>] [/S<server-name>] /c /t,
where:
<database-name> |
is an optional parameter specifying the name of the database.
It can only be omitted if the desired database is the default
database. |
<owner> |
the name of the table owner. |
<table-name> |
the name of the table. |
<csv-file> |
The name of the comma separated file to generate. |
<username> |
The SQL Server username to use. This can be left blank if
NT authentication is used. |
<password> |
The password to use for the account. |
<server-name> |
The name of the server on which the database resides. This
can be omitted if the database is local. |
Note:
for example:
bcp mydb.dbo.sales in sales.csv /U /P /Ssales_fs /c /t,
These notes have been tested against SQL Server 7.
|
|