Wenn man aus einem TSQL Script am SQL Server Betiebsystembefehle ausführen möchte, geht das mit der Stored Procedure xp_cmdshell, die man aber zuerst freischalten muss (da sie ein Sicherheitsrisiko darstellt):
Auf master datenbank als sysadmin ausführen:
EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
RECONFIGURE
Exec xp_cmdShell ‘dir *.*’
No comments:
Post a Comment