SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


UDF AND Stored Procedures


UDF AND Stored Procedures

Author
Message
patelmohamad
patelmohamad
Right there with Babe
Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)

Group: General Forum Members
Points: 785 Visits: 788
Hi Guys,

I know, the question is Funny, but i want to know the details of stored procedures and UDF

I have created a Stored Procedure, i want to use the sp as like UDF
Means a UDF can be use as like "Table" we can create Joins and select a particular field,
same like UDF i want to make a use of Stored Procedure will it be Possible

if yes please provide some article for further studies

Thanks

Patel Mohamad
Kingston Dhasian
Kingston Dhasian
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11339 Visits: 5329
No. You cannot use a Stored Procedure like a UDF.
You can insert the results from a Stored Procedure into a temporary table and work on the temporary table further.


Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
patelmohamad
patelmohamad
Right there with Babe
Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)Right there with Babe (785 reputation)

Group: General Forum Members
Points: 785 Visits: 788
Kingston Dhasian (10/17/2012)
No. You cannot use a Stored Procedure like a UDF.
You can insert the results from a Stored Procedure into a temporary table and work on the temporary table further.


Hi Kingston,

I am creating some documents on Store procedure and UDF , so i need theoretical description why we can not use stored procedure as UDF

Can you please provide some article or any document for further studies

Thanks

Patel Mohamad
Kingston Dhasian
Kingston Dhasian
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11339 Visits: 5329
patelmohamad (10/17/2012)
Kingston Dhasian (10/17/2012)
No. You cannot use a Stored Procedure like a UDF.
You can insert the results from a Stored Procedure into a temporary table and work on the temporary table further.


Hi Kingston,

I am creating some documents on Store procedure and UDF , so i need theoretical description why we can not use stored procedure as UDF

Can you please provide some article or any document for further studies

Thanks


I am not sure if I can get any documents based on this. I will have to Google it.
I will update the thread with links if I get one.

I could get only the below link from Google
http://social.msdn.microsoft.com/Forums/en/transactsql/thread/e699e6b9-09a5-447c-b44f-f559bff03c33
Here, the Microsoft person gives 2 reasons for the limitation


Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
adrian.facio
adrian.facio
Ten Centuries
Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)Ten Centuries (1.4K reputation)

Group: General Forum Members
Points: 1379 Visits: 388
http://blogs.technet.com/b/wardpond/archive/2005/08/01/the-openrowset-trick-accessing-stored-procedure-output-in-a-select-statement.aspx

Maybe this can help litle bit, but is not exactly what you ask for.
Bhuvnesh
Bhuvnesh
SSC-Dedicated
SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)SSC-Dedicated (32K reputation)

Group: General Forum Members
Points: 32186 Visits: 4079
patelmohamad (10/17/2012)
I have created a Stored Procedure, i want to use the sp as like UDF Means a UDF can be use as like "Table" we can create Joins and select a particular field,
same like UDF
Any specifc reasons for it ? performance issues ??

-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
TheSQLGuru
TheSQLGuru
SSC Guru
SSC Guru (76K reputation)SSC Guru (76K reputation)SSC Guru (76K reputation)SSC Guru (76K reputation)SSC Guru (76K reputation)SSC Guru (76K reputation)SSC Guru (76K reputation)SSC Guru (76K reputation)

Group: General Forum Members
Points: 76526 Visits: 8871
You cannot interchange UDFs and sprocs. They can be similar if they both output a variable, but you cannot "join" to the tabular output of a sproc.

Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search