July 10, 2008 at 2:36 am
Hi
How to execute the xp_cmdshell procedure in Sql Server 2005
Thanks and Regards
Suresh
July 10, 2008 at 3:03 am
you need to allow xp_cmdshell in SQL 2005.
Its in the Surface Area management. Then it should be
Example
EXEC xp_cmdshell 'dir "c:\"'
July 10, 2008 at 5:59 am
You have to Enable the xp_cmdshell from
Surface Area Configuration --> Surface Area Configuration for Features.
Complete syntax is ;
xp_cmdshell { 'command_string' } [ , no_output ]
command_string can be any DOS based command.
no_output is specified if you donot want any output fgrom the DOS command after execution (for example, Copy command).
Check:
July 10, 2008 at 11:09 pm
Looks like this
exec master.dbo.xp_cmdshell 'dir c:\temp\*.sql'
you can pretty much do anything you like
for exp
exec master.dbo.xp_cmdshell 'copy c:\ted.txt h:\ted.txt'
and so on
Terry
September 14, 2009 at 3:30 pm
As an alternative, you can also enable xp_cmdshell in code by running the following:
exec sp_configure 'xp_cmdshell', 1
Reconfigure
Bob Pinella
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy