Hi
This is direct from books online. I assume that it is a permissions problem
on xp_cmdshell and not on the directory itself:
"By default, only members of the sysadmin fixed server role can execute this
extended stored procedure. You may, however, grant other users permission to
execute this stored procedure.
When xp_cmdshell is invoked by a user who is a member of the sysadmin fixed
server role, xp_cmdshell will be executed under the security context in
which the SQL Server service is running. When the user is not a member of
the sysadmin group, xp_cmdshell will impersonate the SQL Server Agent proxy
account, which is specified using xp_sqlagent_proxy_account. If the proxy
account is not available, xp_cmdshell will fail. This is true only for
Microsoft® Windows NT® 4.0 and Windows 2000. On Windows 9.x, there is no
impersonation and xp_cmdshell is always executed under the security context
of the Windows 9.x user who started SQL Server."
If this is not a xp_cmdshell permission problem then it could be that access
to the directory for the SQL Server Agent proxy account is not valid or the
user account that started SQL Server for windows 9.x.
As debug option you may want to execute a "dir C:\*" command
John
"Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in message
news:47e5bd72.0407230525.2fc6209b@posting.google.c om...[color=blue]
> John,
> OK, I trashed the isea of a trigger and have adopted your suggection
> of using xp_cmdshell from a stored procedure. Whenever the data is
> inserted into the table in the SP, the same SP calls xp_cmdshell.
>
> This is what I have done...
> I have created a view named vOutput 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.
>
> Can you shed some light on solving this?
>
>
> Alter PROCEDURE OutputOrders
> @FileName nvarchar(50)
>
> AS
> set nocount on
>
> DECLARE @ReturnCode int
> DECLARE @ExportCommand varchar(255)
>
> SET @ExportCommand =
> 'BCP myServerName.dbo.vOutput 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 and on
> the view.
>
>
>
>
>
> "John Bell" <jbellnewsposts@hotmail.com> wrote in message[/color]
news:<GO7Jc.2822$Ec4.33496260@news-text.cableinet.net>...[color=blue][color=green]
> > Hi
> >
> > I am not sure why you should want to do this. If the transaction is[/color][/color]
rolled[color=blue][color=green]
> > back then the file will have different information to the database[/color][/color]
table.[color=blue][color=green]
> > You may want to look at the stored procedure xp_cmdshell, such as
> >
http://tinyurl.com/64azq. Use of the echo command will write the[/color][/color]
information[color=blue][color=green]
> > into a file select @sql = echo ' + @v + ' >
> > \\Myserver\MyShare\myfiledate.txt'
> >
> > Note: The example does not take into account multiple rows in the[/color][/color]
inserted[color=blue][color=green]
> > table.
> >
> > John
> >
> > "Lauren Quantrell" <laurenquantrell@hotmail.com> wrote in message
> > news:47e5bd72.0407131443.33a873bb@posting.google.c om...[color=darkred]
> > > Is there a way to create a text file (such as a Windows Notepad file)
> > > by using a trigger on a table? What I want to do is to send a row of
> > > information to a table where the table: tblFileData has only one
> > > column: txtOutput
> > > I want to use the DB front end (MS Access) to send the text string to
> > > the SQL backend, then have the SQL Server create a file to a path,
> > > such as F:/myfiledate.txt that holds the text in txtOutput, then the
> > > trigger deletes the row in tblFileData.
> > > Can this be done easily?
> > > Any help is appreciated[/color][/color][/color]