SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 set folder permission
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

mejo11
Starting Member

2 Posts

Posted - 03/05/2013 :  11:09:27  Show Profile  Reply with Quote
I have a stored procedure that creates a file/folder, I need to set permission on that folder.
I have searched and searched and can't figure out how to do that, is there a way using tsql.

James K
Flowing Fount of Yak Knowledge

3707 Posts

Posted - 03/05/2013 :  11:25:09  Show Profile  Reply with Quote
There is no native T-SQL command that can change permissions on a folder on the OS. You can use xp_cmdshell to run system commands which in turn would do that. This page has info and examples on xp_cmdshell: http://msdn.microsoft.com/en-us/library/ms175046.aspx

By default xp_cmdshell is disabled. If you need to enable it see here: http://msdn.microsoft.com/en-us/library/ms190693.aspx
Go to Top of Page

mejo11
Starting Member

2 Posts

Posted - 03/05/2013 :  11:58:59  Show Profile  Reply with Quote
Thanks, I was afraid there was not direct way to do it. I know how to copy, move, create using xp_cmdshell but I dont' know how to set security on the folder. Suggestions?
Go to Top of Page

James K
Flowing Fount of Yak Knowledge

3707 Posts

Posted - 03/05/2013 :  12:11:52  Show Profile  Reply with Quote
I have not done that from a command line. This MSDN page might help: http://support.microsoft.com/kb/288292
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000