Contents Index Other system extended stored procedures xp_msver system procedure

ASA SQL Reference
  System Procedures and Functions
    System extended stored procedures
      Other system extended stored procedures

xp_cmdshell system procedure

Function 

Carries out an operating system command from a procedure.

Syntax 

variable = CALL ] xp_cmdshell ( string [ , 'no_output' ] )

Permissions 

None

Description 

xp_cmdshell executes a system command and then returns control to the calling environment.

The default behavior for databases upgraded to 8.0.2 or later is to display output. For older databases, an explicit parameter of a string other than 'no_output' can be used to force output to be displayed.

The second parameter affects only console applications on Windows NT/2000/XP operating systems. For UNIX, no output is displayed regardless of the setting for the second parameter. For NetWare, any commands executed are visible on the server console; regardless of the setting for the second parameter.

Example 

The following statement lists the files in the current directory in the file c:\temp.txt

xp_cmdshell('dir > c:\\temp.txt')

The following statement carries out the same operation, but does so without displaying a command window.

xp_cmdshell('dir > c:\\temp.txt', 'no_output' )

Contents Index Other system extended stored procedures xp_msver system procedure