Friday, March 9, 2012

Dos commands within a stored procedure

Can I issue a dos command like
Cd\fred
Delete *.*
Thanks in advace for your assistance...
use osql.
Mel
|||Yes, though xp_cmdshell. Bu carefully consider the security implications.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
news:98BB887A-EDD1-4D08-966D-2938733502FD@.microsoft.com...
> Can I issue a dos command like
> Cd\fred
> Delete *.*
> Thanks in advace for your assistance...
|||Hi Jim!
Don't forget that xp_cmdshell is disabled in SQL 2005 by default if that's
your platform. You'll need to enable it using the SQL Server Service Surface
Configuration Manager. And your DBA is gonna give you hell for doing so :-)
BTW, you would probably want to do a
del C:\fred\*.*
to chain the commands. And if you run a command shell like 4NT that aliases
commands like del, you may have to make it
*del C:\fred\*.*
Regards,
Jan
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OpneAAZWGHA.3328@.TK2MSFTNGP02.phx.gbl...
> Yes, though xp_cmdshell. Bu carefully consider the security implications.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
> Blog: http://solidqualitylearning.com/blogs/tibor/
>
> "Jim Heavey" <JimHeavey@.discussions.microsoft.com> wrote in message
> news:98BB887A-EDD1-4D08-966D-2938733502FD@.microsoft.com...
>

No comments:

Post a Comment