UDF AND Stored Procedures

  • 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

  • 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/

  • 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

  • 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/

  • 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;-)

  • 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

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply