May 30, 2013 at 7:33 am
I am using bcp to create a text file. It was working fine but stopped working. Here is the bcp command.
exec master..xp_cmdshell 'bcp ''select clientmatter from mytemp order by acctid'' queryout e:\sql_backup\test.txt -c, -T'
The text file is not being created. When I manually place the file in the target directory, the email will not work with the @file_attachments='e:\sql_backup\test.txt'. This is the error msg.
Executed as user: NT AUTHORITY\NETWORK SERVICE. Attachment file e:\sql_backup\test.txt is invalid. [SQLSTATE 42000] (Error 22051). The step failed.
When I remove the @file_attachments='e:\sql_backup\test.txt', the email will work.
Thanks in advance. Mike
May 30, 2013 at 7:51 am
most likely permissions,
if you right click on that specific folder, and go to the security tab, you can see everyone who has permissions.
* Note that NT Authority\Network Service DOES NOT have permissions)
personal folders like \Users\username\Desktop are the same situation.
you'll want to either change the login used to run the service, or change the destination for the file to a fodler NT Authority\Network Service DOES have access to.
Lowell
May 30, 2013 at 8:08 am
That worked!
Thanks Lowell
May 30, 2013 at 9:27 am
Lowell,
Partial success. The file attachment is working but my bcp command now appears to be the problem. The bcp command does not build a new text file:
exec master..xp_cmdshell 'bcp ''select clientmatter from adr_live.dbo.mytemp order by acctid'' queryout e:\sql_backup\test.txt -T -c'
Any Ideas?
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply