Can we execute  stored procedure  inside a user defined function  in ms sql server?

Posted on 2009-02-16
Last Modified: 2012-05-06
Can we execute  stored procedure  inside a user defined function  in ms sql server?

if yes, then can u give an example? is there any adverse effect ?
Question by:Tapan Pattanaik
    LVL 39

    Expert Comment

    No.  Only extended stored procedures.  You also cannot use dynamic SQL in a UDF.
    LVL 20

    Author Comment

    by:Tapan Pattanaik

    Can we use  stored procedure  inside a user defined function  in ms sql server?
    LVL 39

    Accepted Solution

    No you can't, as I stated above.  You can execute EXTENDED stored procedures, but not system or user stored procedures.
    LVL 39

    Expert Comment

    While you may not have gotten the answer you desired, it is 100% correct and a B is not an appropriate answer.  I would ask that you "request attention" and have the grade changed.  Request Attention can be found in your original post.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    The steps for moving the system databases to a new location are documented in the following technical article: However sometimes after the moving process is finished, though SQL i…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now