Saturday, February 25, 2012

Can't create a BCP format file

Hi there,
does anyone know why I cannot create a bcp format file? I get
the following error. If I change the command to queryout instead of format,
it logs on OK and creates an output file. So why am I getting the error
below?
SQLState = 37000, NativeError = 4060
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database
requested in login 'select convert(integer, p'. Login fails.
Waldy,
Please post your bcp command line. As it is, bcp apparently believes that
your login is named
'select convert(integer, p', which is surely not correct.
RLF
"Waldy" <someone@.microsoft.com> wrote in message
news:u1fydnTUIHA.5836@.TK2MSFTNGP04.phx.gbl...
> Hi there,
> does anyone know why I cannot create a bcp format file? I get
> the following error. If I change the command to queryout instead of
> format, it logs on OK and creates an output file. So why am I getting the
> error below?
> SQLState = 37000, NativeError = 4060
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open
> database requested in login 'select convert(integer, p'. Login fails.
>
|||Waldy (someone@.microsoft.com) writes:
> does anyone know why I cannot create a bcp format file? I get the
> following error. If I change the command to queryout instead of format,
> it logs on OK and creates an output file. So why am I getting the error
> below?
> SQLState = 37000, NativeError = 4060
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open
> database requested in login 'select convert(integer, p'. Login fails.
It seems to be a bug in BCP for SQL 2000. I got a similar error for this
command line:
bcp "SELECT CustomerID, COUNT(*) AS cnt FROM Northwind..Orders GROUP BY CustomerID" format xxx -f slask.fmt -T -n
with SQL 2000. With SQL 2005, the error message was more terse:
An error occurred while processing the command line.
The error in SQL 2000 actually makes sense. You are not saying QUERYOUT,
which means that what you have in the first argument is a table. But since
that database and table does not exist...
In any case, since the error message on SQL 2005 is complete crap, I
filed a bug report
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=321353
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

No comments:

Post a Comment