Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Bcp error

Author  Topic 

cable_si
Starting Member

20 Posts

Posted - 2008-09-03 : 08:00:25
Hi All

We have just upgaded our old sql server from 2000 to a 2005 cluster server

I am now having problems running some bcp commands

The command i am running is

exec master..xp_cmdshell 'bcp "select fileoutput from [new_db]..[Invoice_Table] order by roworder" queryout c:\invoice\template\customer.html -c -o c:\invoice\template\bcpOutput.txt'

the error i am getting is

User name not provided, either use -U to provide the user name or use -T for Trusted Connection



i have tried to add in -U and -P but then get the below

SQLState = 08001, NativeError = 2
Error = [Microsoft][SQL Native Client]Named Pipes Provider: Could not open a connection to SQL Server [2].
SQLState = HYT00, NativeError = 0
Error = [Microsoft][SQL Native Client]Login timeout expired
SQLState = 08001, NativeError = 2
Error = [Microsoft][SQL Native Client]An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

Can anyone help at all ?

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-03 : 09:18:30
Did you enable xp_cmdshell on Surface area Config?
Go to Top of Page

cable_si
Starting Member

20 Posts

Posted - 2008-09-03 : 09:26:18
Hi

xp_cmdshell is enabled and is working fine
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-09-03 : 10:27:02
you didn't specify a server in this command. that means by default bcp.exe will try to connect to the local default (unnamed) instance. if there is no unnamed instance you'll get the login timeout error.

bcp "select fileoutput from [new_db]..[Invoice_Table] order by roworder" queryout c:\invoice\template\customer.html -c -o c:\invoice\template\bcpOutput.txt

is this running on a named instance? if so you need to add a -SSERVER\INSTANCE flag to the bcp command.


elsasoft.org
Go to Top of Page

cable_si
Starting Member

20 Posts

Posted - 2008-09-03 : 11:57:56
Hi

It is running a named instance, i have tried adding in

exec master..xp_cmdshell 'bcp "select fileoutput from [new_db]..[Invoice_Table] order by roworder" queryout c:\invoice\template\customer.html -c -o -STCSQL1\sqlcluster c:\invoice\template\bcpOutput.txt'

but i get the same error

Go to Top of Page
   

- Advertisement -