BCP Extract Files Error

  • Hi there - I run this code on several environments successfully but when on run it on a different environment it fails.

    Its very strange as the user has database SA and OS administrator permissions.

    Can anyone help me with this one;

    Code...

    declare @Command varchar (250)

    set @Command = 'bcp "SELECT * FROM QAProcess.dbo.ReadMe_Table" queryout "\\THOMSONS-SQL01\Temp\ReadMe.txt" -c -T'

    EXEC master..xp_cmdshell @Command

    Error....

    SQLState = 28000, NativeError = 18456

    Error = [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'T-BX\SQLServerAccount'.

    NULL

    Thanks!

    --------------------------------------------

    Laughing in the face of contention...

  • arrjay (2/24/2015)


    Hi there - I run this code on several environments successfully but when on run it on a different environment it fails.

    Its very strange as the user has database SA and OS administrator permissions.

    Can anyone help me with this one;

    Code...

    declare @Command varchar (250)

    set @Command = 'bcp "SELECT * FROM QAProcess.dbo.ReadMe_Table" queryout "\\THOMSONS-SQL01\Temp\ReadMe.txt" -c -T'

    EXEC master..xp_cmdshell @Command

    Error....

    SQLState = 28000, NativeError = 18456

    Error = [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'T-BX\SQLServerAccount'.

    NULL

    Thanks!

    You're running the code from SQL Server. SQL Server is running under a service account 'T-BX\SQLServerAccount'. When SQL Server tries to execute the BCP command, it tries to log in to the share with the service account. That service account probably doesn't have write permissions to \\THOMSONS-SQL01\Temp

    At least, that's the first place I usually have to look for issues like this.

  • Thanks but I have done this. I have actually given it to everyone just to be completely sure but its still failing.

    Any other ideas?

    --------------------------------------------

    Laughing in the face of contention...

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply