TSQL: 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'

原文地址:https://www.cnblogs.com/aot/p/2993988.html