Hello. I have SQL stored proc that returns 5 columns. I want to execute that SP and place the data into a temp table, but I only want to return 3 of the 5 columns. Logically I assumed I could do this by defining my temp table with the 3 fields I need, then run an INSERT INTO also specifying the 3 fields.
Problem is when I run it I receive an error message "Column name or number of supplied values does not match table definition".
Sample code is below. Any way I can execute the SP and only return a, b, and c into the temp table?
Create Table #TempTable ([a] varchar (20) null,
[b] varchar (20) null,
[c] varchar (20) null)
Insert Into #TempTable ([a], [b], [c])
Execute mystoredproc -- this sp returns fields a,b,c,d,e