From: jtaylor on
I'm trying to use "bcp" on a SQL Server database whose name contains
an embedded blank. I tried everything I can think of, but cannot find
the correct syntax.

Any ideas?
From: Plamen Ratchev on
Did you try [Database name]?

--
Plamen Ratchev
http://www.SQLStudio.com
From: jtaylor on
Yes. I tried:
bcp [dataBase Name].dbo.table out PC.file -nT -S host\instance
and it returned:
Copy direction must be either 'in', 'out' or 'format'.



On Oct 8, 9:40 am, Plamen Ratchev <Pla...(a)SQLStudio.com> wrote:
> Did you try [Database name]?
>
> --
> Plamen Ratchevhttp://www.SQLStudio.com

From: Plamen Ratchev on
Forgot, you have to use the -q option. Here is from BOL:

-q
Executes the SET QUOTED_IDENTIFIERS ON statement in the connection between the bcp utility and an instance of SQL
Server. Use this option to specify a database, owner, table, or view name that contains a space or a single quotation
mark. Enclose the entire three-part table or view name in quotation marks ("").

To specify a database name that contains a space or single quotation mark, you must use the �q option.

--
Plamen Ratchev
http://www.SQLStudio.com
From: jtaylor on
Tried:
bcp -q 'dataBase Name.dbo.table' out PC.file -nT -S host\instance
and
bcp 'dataBase Name.dbo.table' out PC.file -nqT -S host\instance
but both still gave the same error message.



On Oct 8, 10:09 am, Plamen Ratchev <Pla...(a)SQLStudio.com> wrote:
> Forgot, you have to use the -q option. Here is from BOL:
>
> -q
> Executes the SET QUOTED_IDENTIFIERS ON statement in the connection between the bcp utility and an instance of SQL
> Server. Use this option to specify a database, owner, table, or view name that contains a space or a single quotation
> mark. Enclose the entire three-part table or view name in quotation marks ("").
>
> To specify a database name that contains a space or single quotation mark, you must use the –q option.
>
> --
> Plamen Ratchevhttp://www.SQLStudio.com