I have created a view named viewOutput that shows one column in a
table.
I insert a row into the table and then I'm using this code to create a
file with the text in the single row.
This code works fine when I'm signed on with an account that has
server admin rights, however it fails when I signin with an account
that does not have server admin rights.
I'm hoping someone can help me with this.
Alter PROCEDURE OutputOrders
@FileName nvarchar(50)
AS
set nocount on
DECLARE @ReturnCode int
DECLARE @ExportCommand varchar(255)
SET @ExportCommand =
'BCP myServerName.dbo.viewOutput out "c:\output\order files\' +
@TemplateFileName +
'" -T -c -S ' + @@SERVERNAME
EXEC @ReturnCode = master.dbo.xp_cmdshell @ExportCommand
I have granted execute permission to xp_cmdshell for both users.