Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Delete Operating System File from SQL SERVER

Author  Topic 

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-02-27 : 02:58:40

Is there any idea regarding query to delete any operating system file from sql server.

Basically i want to delete temp files in tmp folder of Windows.

-----
sim

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-02-27 : 03:34:42
Youc can make use of xp_cmdshell provided SQL Server has access to the specified folder.

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-02-27 : 04:33:46
now the error is:

Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1
SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.
Go to Top of Page

lionofdezert
Aged Yak Warrior

885 Posts

Posted - 2008-02-27 : 04:35:15
thanx i got it...

-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
Go to Top of Page
   

- Advertisement -