T-SQL: Create folders in remote server by sql statement

I got two options to create directory in the remote server by executing T-SQL:

1. xp_cmdshell

EXECUTE master..xp_cmdshell N'md "c:\db\backup"'

--Or you can create a bat to wrap multiple scripts

But you have to turn on xp_cmdshell settings to allow this command execution correctly.

2. xp_create_subdir

EXEC master..xp_create_subdir N'c:\db\backup'

posted @ 2013-04-01 17:49  AOT  阅读(134)  评论(0编辑  收藏  举报