Article ID: 264058 - View products that this article applies to.
This article was previously published under Q264058
This article has been archived. It is offered "as is" and will no longer be updated.
BUG #: 57977 (SQLBUG_70)
When an xp_cmdshell extended stored procedure query returns information to a table, if the table is declared with more columns than xp_cmdshell returns, the client receives an Access Violation (AV). The following script:
returns the following error message:
Server: Msg 213, Level 16, State 7, Procedure xp_cmdshell, Line 5
Insert Error: Column name or number of supplied values does not match table definition.
ODBC: Msg 0, Level 20, State 1
Stored function 'xp_cmdshell' in the library 'xpsql70.dll' generated an
access violation. SQL Server is terminating process 13.
Declare the table with the correct number of columns. In the preceding example, if you remove col2, the query works correctly.