Mega Code Archive

 
Categories / MSSQL Tutorial / Transact SQL
 

Use function returned value

5> 6> 7>     DECLARE @myresult int 8>     EXEC @myresult = xp_cmdshell "dir c:\tim.txt" 9>     IF (@myresult = 0) 10>         PRINT "Success" 11>     ELSE 12>         PRINT "Failure" 13>     GO Msg 15281, Level 16, State 1, Server J\SQLEXPRESS, Procedure xp_cmdshell, Line 1 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 c an 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. Failure