15.9.08

SQL Server error

While trying to write my data in to an external file (Like logging the sql output into an external text file). I found this error,

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.
Reason:
Its because, by default sql server will disable xp_cmdshell property and we need to enable it.
Goto Surface Area Configuration manager and enableit.

Click apply, now you can achieve your tasks.

You can achieve it using T-SQL too.

Clearly you'll need sa privileges on your SQL instance to run this:
sp_configure 'show advanced options',

RECONFIGURE

GO

sp_configure 'xp_cmdshell',

GO

RECONFIGURE

GO

Regards,

Venkatesan Prabu .J

No comments:

Post a Comment