Login    
 
 
 
 
Text/HTML
  
You are here :: Blogs Saturday, May 19, 2012

Search
Note: This uses the internal blog search engine. The Google search engine is also available at the top of the page.
  
Disclaimer

Please review the site disclaimer before downloading or using content found on this site

  
Categories
  
DEVSHED Blog
As always, I welcome your comments!
May 9

Written by: Steve Gray
5/9/2011 4:55 PM  RssIcon

Here’s a quick example of how to insert the results of a stored procedure into a table. It’s pretty simple, not much explanation needed

  1. Create Proc usp_getItems
  2. as
  3.  
  4. --dummy return values
  5. select 'ITM001' as itemnmber, 'Big Item' as itemDescription
  6. union
  7. select 'ITM002' as itemnmber, 'Little Item' as itemDescription
  8. union
  9. select 'ITM003' as itemnmber, 'Red Item' as itemDescription
  10. union
  11. select 'ITM004' as itemnmber, 'Blue Item' as itemDescription
  12.  
  13. go
  14.  
  15. --send the results of the stored proc into a table
  16.  
  17. Declare @myTemp as table (itemnmbr varchar(10), itemdescription varchar(30) )
  18.  
  19. insert into @myTemp (itemnmbr, itemdescription)
  20.     exec usp_getItems
  21.     
  22. select * from @myTemp

 

The results look like this:

image

Tags:
Categories:
Location: Blogs Parent Separator DEVSHED Blogs Child Separator SQL
As always, I welcome your comments!
  
 
 
Home | Products | Blogs | Contact Us | Links | God's Plan
Privacy Statement | Terms Of Use
 
Copyright 2011 by Devshed.us