troubleshooting Question

Insert Stored Procedure results into a table variable with extra columns

Avatar of MadIce
MadIce asked on
Microsoft SQL Server
3 Comments1 Solution447 ViewsLast Modified:
I have a table variable with five columns and defaults set but can't get a stored procedure results to insert into table.

declare @Results table (
Col1 varchar(50),
Col2 varchar(50),
Col3 varchar(50),
Col4 int default 0,
Col5 varchar(50) default null

Insert into @Results
Exec uspGetResults

The uspGetResults returns 3 columns of data.  If I remove the last two columns in @Results works fine.  

I could add two columns to the uspGetResults table but would rather not because it's used for other purposes.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros