all groups > sql server programming > september 2006 >
You're in the

sql server programming

group:

calling sp within SELECT



calling sp within SELECT Mukut
9/15/2006 9:21:20 PM
sql server programming: All,

Pls do bother to read the following:

Insert into <table name>
( col1,
col2,
.......,
coln
)
select (
<value>,
<value>,
...........,
XXX
)
from <table name>

We are inserting 100 or whatever no of rows in the table.And, in place
of XXX, we need to call a sp and the output will be stored in coln.

How we could do this?
What we definitely require is to put the the output value of sp in coln
when we insert rows in the table.
If you have any better way to do this , pls pls share with us.

Thanks ,
Mukut
Re: calling sp within SELECT Erland Sommarskog
9/16/2006 12:00:00 AM
Mukut (hidevraj@gmail.com) writes:
[quoted text, click to view]

I have an article on my web site that covers a couple of possibilities
to handle this situation:
http://www.sommarskog.se/share_data.html


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
Re: calling sp within SELECT Hari Prasad
9/16/2006 12:29:15 AM
Hi,

You can not do that using a procedure. But this can be attained using user
defined function returning Table.
Take a look into Inline table-valued functions in books online..

Thanks
Hari
SQL Server MVP

[quoted text, click to view]

AddThis Social Bookmark Button