views:

263

answers:

2

I am having an issue with SQL Server 2005's BCP utility. I am running SQL Server Express 2005 on Windows Vista. I am trying to create a non-XML format file for some tables in my database.

I run the following code:

bcp 'jProd_000-1'.users format nul -T -f users.fmt 

I get the following error:

An Error occurred while processing the command line

It doesn't display any other helpful information with regards to the error. I also used a SQL Server login instead of the '-T'. Can anyone provide any insight? What am I doing wrong?

Thank you!

A: 

Your quoting looks a little odd. Is jProd_000-1 a schema?

Assuming it is, try

bcp "jProd_000-1.users" format nul -T -f users.fmt 

However, this may not do what you expect - it will ask you to define the datatypes for each column manually.

There's no way I'm aware of to automatically generate a non-XML format file.

Ed Harper
No joy. The, jPRod_000-1 is a false database name i just made up. The actual contains the same type of characters (which using "_" and "-" isnt exactly good protocol for defining a database name). Users is the table name. Atleast according to Microsoft's how-to, you can automate it (http://msdn.microsoft.com/en-us/library/ms191516.aspx). Have you done this before by hand? This has to be something obvious but i'm not seeing it. I tried using the databasename.dbo.tablename and it didnt work either.
Gavin
Is there any way to output more descriptive error messages?
Gavin
A: 

I just figured it out... yeah rookie mistake. It had to do with the database name I used. Aparently there's no way to use BCP on database names that contain "-"'s, even if you put the database name in double or single quotes. Thank you for the response!

Gavin