1

When I run the command, I get Column name or number of supplied values does not match table definition.

The output from sp_help_jobhistory returns 11 columns which I have defined in my table.

Here is the code:

CREATE table #holdResults (jobid uniqueidentifier,  job_name sysname,
     runstatus int,  rundate int,  runtime int, runduration  int,  
     opemail int, openet int, oppage int,  retry int,  server varchar(25)       )  
     exec master..xp_cmdshell 'sqlcmd -E -S DEVSQL03 -Q "msdb.dbo.sp_help_jobhistory @job_name = ''DEVSQL03-NexusDistrictMyrtlefo-Nexus District Myrtle-DEVSQL03-95''"'

Results:

Msg 213, Level 16, State 7, Procedure xp_cmdshell, Line 1 [Batch Start Line 0]
Column name or number of supplied values does not match table definition.
1
  • What does exec master..xp_cmdshell ... return? Why use xp_cmdshell at all? If not running on DEVSQL03, you can use a linked server. Commented Apr 9 at 1:55

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.