Home > Archive > MS SQL Server > April 2006 > Dos commands within a stored procedure









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Dos commands within a stored procedure
Jim Heavey

2006-04-06, 11:23 am

Can I issue a dos command like
Cd\fred
Delete *.*

Thanks in advace for your assistance...
MSLam

2006-04-06, 11:23 am

use osql.

Mel

Tibor Karaszi

2006-04-06, 11:24 am

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@discussion
s.microsoft.com> wrote in message
news:98BB887A-EDD1-4D08-966D- 2938733502FD@microso
ft.com...
> Can I issue a dos command like
> Cd\fred
> Delete *.*
>
> Thanks in advace for your assistance...


Jan Van der Eecken

2006-04-06, 8:23 pm

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@hotmai
l.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@discussion
s.microsoft.com> wrote in message
> news:98BB887A-EDD1-4D08-966D- 2938733502FD@microso
ft.com...
>



Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com