SQL SERVER Insert result of a Stored Procedure in to a table

0
19

Result of Stored procedures are key in most SQL issues, to import resultset into a table , first the DB should include the table,

insert into will not work with this scenario

For Eg.

Create proc PrintDate

as

select getdate()

We need to insert result of this proc to a table called table1

create table1 first

Remember the Table Structure should Match with the Resultset Structure

create table table1

(

d datetime

)

to insert value of this proc to table table1 use the following syntax

insert <table> exec <procname>

here

insert table1 exec PrintDate

 

Select * from table1

Result

2011-06-13 17:06:16.890

SHARE
Previous articleADO.NET Data Services
Next articleAngry Birds for google chrome andplay offline
abhilash, is a programmer by profession and a technology addict with a passion towards browsing , shopping and imaging . My views may be biased on reviews. all images and videos are copyrighted to respective owners.

LEAVE A REPLY

Please enter your comment!
Please enter your name here