Difference between Stored procedure vs User Functions in Sql server
• Procedure may return none or more values. Function must always return one value either a scalar value or a table.
• A user-defined function takes zero or more input parameters and returns either a scalar value or a table.
• Procedure have input,output parameters.Functions have only input parameters.
• Stored procedures are called independently by EXEC command whereas Functions are called from within SQL statement.
• Functions can be called from procedure. Procedures cannot be called from function.
• Exception can be handled in Procedure by try-catch block but try-catch block cannot be used in a function.(error-handling)
• Transaction management possible in procedure but not in function.
Dotnet, DotnetCore, Azure, C#,VB.net, Sql Server, WCF, MVC ,Linq, Javascript and Jquery
Showing posts with label Difference between Stored procedure vs User Functions in Sql server. Show all posts
Showing posts with label Difference between Stored procedure vs User Functions in Sql server. Show all posts
18 September 2010
26 April 2010
Difference between Stored procedure vs User Functions in Sql server
In many situation you can do the same task using either a stored procedure or a function.
Fundamental difference between Stored procedure vs User Functions:
•Procedure may return none or more values.Function must always return one value either a scalar value or a table.
•Procedure have input,output parameters.Functions have only input parameters.
•Stored procedures are called independently by EXEC command whereas Functions are called from within SQL statement.
•Functions can be called from procedure.Procedures cannot be called from function.
•Exception can be handled in Procedure by try-catch block but try-catch block cannot be used in a function.(error-handling)
•Transaction management possible in procedure but not in function.
Procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only SELECT statement in it.
Fundamental difference between Stored procedure vs User Functions:
•Procedure may return none or more values.Function must always return one value either a scalar value or a table.
•Procedure have input,output parameters.Functions have only input parameters.
•Stored procedures are called independently by EXEC command whereas Functions are called from within SQL statement.
•Functions can be called from procedure.Procedures cannot be called from function.
•Exception can be handled in Procedure by try-catch block but try-catch block cannot be used in a function.(error-handling)
•Transaction management possible in procedure but not in function.
Procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only SELECT statement in it.
Subscribe to:
Posts (Atom)
Implementing OAuth validation in a Web API
I mplementing OAuth validation in a Web API Implementing OAuth validation in a Web API using C# typically involves several key steps to sec...
-
ViewBag, ViewData, TempData and View State in MVC ASP.NET MVC offers us three options ViewData, ViewBag and TempData for passing data from...
-
// Export Datatable to Excel in C# Windows application using System; using System.Data; using System.IO; using System.Windows.Forms; ...