Re: xp_cmdshell not creating txt file
From: D (D_at_discussions.microsoft.com)
Date: 07/19/04
- Next message: Kalen Delaney: "Re: Database access"
- Previous message: Gav: "Restore 225GB database. ASYNC_IO_COMPLETION. (Help! I need this doing by morning) :o)"
- In reply to: Hari Prasad: "Re: xp_cmdshell not creating txt file"
- Next in thread: Aaron [SQL Server MVP]: "Re: xp_cmdshell not creating txt file"
- Messages sorted by: [ date ] [ thread ]
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
>
>
>
- Next message: Kalen Delaney: "Re: Database access"
- Previous message: Gav: "Restore 225GB database. ASYNC_IO_COMPLETION. (Help! I need this doing by morning) :o)"
- In reply to: Hari Prasad: "Re: xp_cmdshell not creating txt file"
- Next in thread: Aaron [SQL Server MVP]: "Re: xp_cmdshell not creating txt file"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|