Re: xp_cmdshell not creating txt file

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: D (D_at_discussions.microsoft.com)
Date: 07/19/04


Date: Mon, 19 Jul 2004 12:55:03 -0700

These are the results that I receive when I try to put the results on my hard drive.

master..xp_cmdshell 'osql -SServer -Usa -Ppass -h-1 -o \\d (machine name from windows properties)\desk (shared name on network)\c:\temp\cust_contact.txt -Q" set nocount on;select name from master..sysobjects" '

results>>>>

>>>>output
>>>>Cannot open output file - \\d (machine name from windows properties)\desk >>>>(shared name on network) \c:\temp\cust_contact.txt
>>>>No such file or directory

"Hari Prasad" wrote:

> Hi,
>
> XP_CMDSHELL will write to the servers C drive not to your hard disk. To keep
> the output in your hard disk you need mention the UNC path. But to write to
> UNC path the SQL server service account should have previlages to your C
> drive.
>
> master..xp_cmdshell 'osql -Sserver -Usa -Ppassword -h-1 -o
> \\machine_name\sharename\cust_contact.txt -Q" set nocount on;select name
> from master..sysobjects" '
>
> --
> Thanks
> Hari
> MCDBA
> "D" <D@discussions.microsoft.com> wrote in message
> news:64C85D4D-3A9A-40C4-B441-47AB01CB4F3F@microsoft.com...
> > I found this code as a sample code to test the xp_cmdshell function.
> > osql -Smyserver -Usa -Psapass -h-1 -o c:\temp\cust_contact.txt -Q" set
> nocount on;select ContactName, Phone from Northwind.dbo.Customers order by
> ContactName"
> >
> > But I can't get it to create the txt file on my hard drive. What else
> needs to be enabled for this to work? I need a txt file to be created on my
> hard drive.
> >
> > Thank
>
>
>



Relevant Pages

  • Re: xp_cmdshell not creating txt file
    ... XP_CMDSHELL will write to the servers C drive not to your hard disk. ... UNC path the SQL server service account should have previlages to your C ... > I found this code as a sample code to test the xp_cmdshell function. ...
    (microsoft.public.sqlserver.server)
  • Re: .net COM+ component writing a file to UNC path causes MSDTC er
    ... In the UNC path I was specifying the server name, ... to the machine, so was routed elsewhere on the network, hence the 'partner ... transaction manager has disabled its support for remote/network transactions' ... > Are the two servers part of the same Windows domain? ...
    (microsoft.public.dotnet.framework.component_services)
  • Re: SP2 not isntalled VIA GPO but shows SP1
    ... I had servers IP Address in the UNC path ... ... > it in the ADD/Remove but this other one show it installing for 10 seconds at ... >> * PLEASE post all messages and replies in the newsgroups ...
    (microsoft.public.windowsxp.network_web)
  • Re: cd with terminal to external drive
    ... external hard drive but can't get any higher up the hierarchy than my ... hard disk. ... I can, apparently, get to servers on the local network (I ...
    (comp.sys.mac.apps)
  • Re: FreeBSD Server Panics & Reboots
    ... I saw something with one of the servers I admin where ftpd crashed ... when two people were on at the same time for the same amount of ... page fault while in kernel mode ... > I dont think it is a hard disk issue since the hard disks were replaced ...
    (freebsd-questions)