Saturday, January 24, 2009

Error = [Microsoft][SQL Native Client]Unable to open BCP host data-file

Today when I was working on some job creation, I encountered this error message which is nothing but OS Level permission issue blocking BCP to transact with the file specified.

Error Message:
Error = [Microsoft][SQL Native Client]Unable to open BCP host data-file

T-SQL Command Used:
EXEC master..xp_cmdshell 'BCP "SELECT * FROM ABC" QUERYOUT "D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Errors.txt" -SSQLSERVER1 -T -c'

Root Cause:
BCP exe was not having write access to the file specified above "Errors.txt"

Solution:
Go to Secutiry settings in the parent folder or the exact file and give WRITE permission.

No comments:

Post a Comment

Please do not spam!