Home All Groups Group Topic Archive Search About

Urgent! BCP command failed on SQL2000, but okay on SQL7

Author
31 Mar 2006 12:03 AM
June
Hi,

Environment: Win2000, SQL2000
Both the command file and SQL2000 are installed on the same machine.

I have a command file with the following SQL statement:

bcp "SELECT * FROM [%dbname%].[dbo].[%1] WHERE DATEDIFF(hour,TimeStamp,
DATEADD(n, -DATEPART(n,getdate()), getdate())) <=24" queryout %CurDate%.tmp
-U -P -f %formatfile%

I can run this file on a machine with SQL7 installed, but have error when I
run it on a machine with SQL2000. Here is the error:

SQLState = 08001, Native Error=17
Error=[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does not
exist or access denied.

SQLState = 01000, Native Error=2
Warning=[Microsoft][ODBC SQL Server Driver][Shared
Memory]ConnectionOpen(Connect()).

I also tried to add parameter with -S server_name\instance_name.
I got similar error messages:

SQLState = 08001, Native Error=17
Error=[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not
exist or access denied.

SQLState = 01000, Native Error=2
Warning=[Microsoft][ODBC SQL Server
Driver][DBNETLIB]ConnectionOpen(Connect()).

Does anyone know where is the problem? How can I fix it?

Thanks for the support!

Author
31 Mar 2006 7:41 AM
Erland Sommarskog
June (J***@discussions.microsoft.com) writes:
Show quote
> Environment: Win2000, SQL2000
> Both the command file and SQL2000 are installed on the same machine.
>
> I have a command file with the following SQL statement:
>
> bcp "SELECT * FROM [%dbname%].[dbo].[%1] WHERE DATEDIFF(hour,TimeStamp,
> DATEADD(n, -DATEPART(n,getdate()), getdate())) <=24" queryout
> %CurDate%.tmp -U -P -f %formatfile%
>
> SQLState = 08001, Native Error=17
> Error=[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server does
> not exist or access denied.
>...
>
> I also tried to add parameter with -S server_name\instance_name.
> I got similar error messages:

Can you connect to this SQL Server by other means on this machine? Is this
a named instance of the default instance?

Normally when you get this error and the server you are trying to connect
to is one the same box, it indicates that that server is not running. It's
not much a problem withg BCP per se.


--
Erland Sommarskog, SQL Server MVP, esq***@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

AddThis Social Bookmark Button