Error running BCP

Error running BCP

Post by twoplus.. » Tue, 24 Oct 2000 04:00:00



 Hi,

I'm trying to get the hang of BCP and as a trail, I've executed the
basic command (from my desktop -  SQL 7.0)  .... of which I keep getting
the error below:
Any ideas what I am doing wrong...? Is there a simplier way to copy data
to a text file?

Thanks
TwoPlusTwo

EXEC master..xp_cmdshell 'bcp "SELECT * FROM Northwind..products"
queryout C:\TestData\teststuff.txt -T -c -SMERLYN'

SQLState = 37000, NativeError = 18452
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
user '(null)'. Reason: Not associated with a trusted SQL Server
connection.

(2 row(s) affected)

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

Error running BCP

Post by Dan Guzma » Tue, 24 Oct 2000 04:00:00


I assume you are not an SA.  In this case, the trusted connection is via the
SQLAgentCmdExec account.  Your command will work fine if you add the
SQLAgentCmdExec account login to the SQL Server and database.

Hope this helps.


Quote:> Hi,

> I'm trying to get the hang of BCP and as a trail, I've executed the
> basic command (from my desktop -  SQL 7.0)  .... of which I keep getting
> the error below:
> Any ideas what I am doing wrong...? Is there a simplier way to copy data
> to a text file?

> Thanks
> TwoPlusTwo

> EXEC master..xp_cmdshell 'bcp "SELECT * FROM Northwind..products"
> queryout C:\TestData\teststuff.txt -T -c -SMERLYN'

> SQLState = 37000, NativeError = 18452
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
> user '(null)'. Reason: Not associated with a trusted SQL Server
> connection.

> (2 row(s) affected)

> Sent via Deja.com http://www.deja.com/
> Before you buy.


 
 
 

Error running BCP

Post by twoplus.. » Wed, 25 Oct 2000 04:00:00


Thanks Dan,
I'm a little "green" in the SQL Server area...Can you tell me how to go
about the task...
Is it different from a win98/desktop (SQL 7.0) to a Server platform?

Thanks

TwoPlusTwo



> I assume you are not an SA.  In this case, the trusted connection is
via the
> SQLAgentCmdExec account.  Your command will work fine if you add the
> SQLAgentCmdExec account login to the SQL Server and database.

> Hope this helps.



> > Hi,

> > I'm trying to get the hang of BCP and as a trail, I've executed the
> > basic command (from my desktop -  SQL 7.0)  .... of which I keep
getting
> > the error below:
> > Any ideas what I am doing wrong...? Is there a simplier way to copy
data
> > to a text file?

> > Thanks
> > TwoPlusTwo

> > EXEC master..xp_cmdshell 'bcp "SELECT * FROM Northwind..products"
> > queryout C:\TestData\teststuff.txt -T -c -SMERLYN'

> > SQLState = 37000, NativeError = 18452
> > Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
for
> > user '(null)'. Reason: Not associated with a trusted SQL Server
> > connection.

> > (2 row(s) affected)

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

Error running BCP

Post by Dan Guzma » Wed, 25 Oct 2000 04:00:00


I'm only familiar with NT/Win2k in this area; I don't know what OS security
context xp_cmdshell uses under Win9x.

If you can't find the answer, you can also try a standard security login.
Add a SQL Server standard login, grant access to the database and specify
the login and password (instead of -T) in the BCP command line:

EXEC master..xp_cmdshell 'bcp "SELECT * FROM Northwind..products" queryout
C:\TestData\teststuff.txt -ULoginName -PLoginPassword -c- -SMERLYN'

Hope this helps.


> Thanks Dan,
> I'm a little "green" in the SQL Server area...Can you tell me how to go
> about the task...
> Is it different from a win98/desktop (SQL 7.0) to a Server platform?

> Thanks

> TwoPlusTwo



> > I assume you are not an SA.  In this case, the trusted connection is
> via the
> > SQLAgentCmdExec account.  Your command will work fine if you add the
> > SQLAgentCmdExec account login to the SQL Server and database.

> > Hope this helps.



> > > Hi,

> > > I'm trying to get the hang of BCP and as a trail, I've executed the
> > > basic command (from my desktop -  SQL 7.0)  .... of which I keep
> getting
> > > the error below:
> > > Any ideas what I am doing wrong...? Is there a simplier way to copy
> data
> > > to a text file?

> > > Thanks
> > > TwoPlusTwo

> > > EXEC master..xp_cmdshell 'bcp "SELECT * FROM Northwind..products"
> > > queryout C:\TestData\teststuff.txt -T -c -SMERLYN'

> > > SQLState = 37000, NativeError = 18452
> > > Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
> for
> > > user '(null)'. Reason: Not associated with a trusted SQL Server
> > > connection.

> > > (2 row(s) affected)

> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.

> Sent via Deja.com http://www.deja.com/
> Before you buy.

 
 
 

1. Error running BCP

Whilst trying to carry out a bcp from within SQL server 6.5 with the
following command line structure

EXEC master..xp_cmdShell "bcp database.dbo.table in 'filepath'
        /f'formatpath'  /e'errorpath' /Uusername /Ppassword /Sserver"

 I get the following error

Cannot find the function 'xp_cmdShell' in the library 'xpsql60.dll'.
Reason: '127(The specified procedure could not be found.)'

I have not been able to find out what this means but have not been able
to.

I am using the account as a non sa and have permissions to execute
xp_cmdShell. Apparently the sa has run xp_cmdShell within the database
server and it works OK.

Any help would be appreciated.

MBH

Sent via Deja.com http://www.deja.com/
Before you buy.

2. foreign key question

3. Errors running bcp command

4. Red Alert: Delete method in ActiveX Controls

5. ODBC, BCP Error: Unable to open BCP host data-file

6. BCP Error: Connection is not enabled for BCP

7. ODBC, BCP Error: Unable to open BCP host data-file

8. BCP error or SQL Server error?

9. Using xp_cmdshell to run BCP...