Ravi Patel
what is diff between stored procedure and function
By Ravi Patel in Databases & DBA on Apr 19 2014
  • Jiseo Lee
    Oct, 2016 18

    ??? runman7942.com ?? ???? ???? ?? ????

    • 0
  • Kml Surani
    May, 2015 13

    http://www.dotnet-tricks.com/Tutorial/sqlserver/7EDL150912-Difference-between-Stored-Procedure-and-Function-in-SQL-Server.html

    • 0
  • Ramesh  Maruthi
    Aug, 2014 11

    Ping a machine using C# Why am I Passionate about C-SharpC ... Basic difference between ASP and A ...BLOGVishal Nayan141 1,006 Difference between stored procedure and Functions By Vishal Nayan in Blogs | SQL on Apr 30, 2011 What is difference between Stored procedure and Functions? Stored procedures:inShare67782 0 What is difference between Stored procedure and Functions?Stored procedures:1) have to use EXEC or EXECUTE 2) return output parameter 3) can create table but won't return Table Variables 4) you cannot join SP 5) Can be used to change server configuration. 6) Can be used with XML FOR Clause 7) can have transaction within SP8) Procedures can be used for performing business logic9) Sp takes input, output parameters, 10) Sp cannot be called directly into DML statements 11) PROCEDURE may return one or more values through parameters or may not return at all 12) Procedure can return multiple values (max 1024). 13) Stored procedure returns always integer value by default zero. 14) Stored procedure is precompiled execution plan 15) Procedure cannot be used in SQL queriesFunctions1) Can be used with Select statement 2) Not returning output parameter but returns Table variables 3) We can join UDF 4) Cannot be used to change server configuration. 5) Cannot be used with XML FOR clause 6) cannot have transaction within function7) Functions are used for computations 8) Function takes only input parameters. 9) Functions can be called directly into DML statements. 10) A FUNCTION is always returns a value using the return statement 11) A Function returns 1 value only. 12) Whereas function returns type could be scalar or table or table values 13) A function can call directly by SQL statement like select func_name from dual14) A Function can be used in the SQL Queries

    • 0
  • Payal Sharma
    Aug, 2014 11

    Functions ---------- 1) can be used with Select statement 2) Not returning output parameter but returns Table variables 3) You can join UDF 4) Cannot be used to change server configuration 5) Cannot be used with XML FOR clause 6) Cannot have transaction within functionStored Procedure ----------------- 1) have to use EXEC or EXECUTE 2) return output parameter 3) can create table but won’t return Table Variables 4) you can not join SP 5) can be used to change server configuration 6) can be used with XML FOR Clause 7) can have transaction within SP

    • 0
  • Rajesh  kumar
    Apr, 2014 28

    Stored Procedures 1. Can be used to read and modify data. 2. Can use used with XML FOR clause 3. Can use a UDF inside a SP in SELECT statement. 4. Cannot be used to create constraints while creating a table. function 1.Can only read data, cannot modify the database 2. - Cannot be used with XML FOR clause 3.Cannot execute an SP inside a UDF. 4 Can be used to create Constraints while creating a table. 5 Cannot execute some non-deterministic built-in functions, like GETDATE().

    • 0
  • Shweta Lodha
    Apr, 2014 23

    Basic Difference Function must return a value but in Stored Procedure it is optional( Procedure can return zero or n values). Functions can have only input parameters for it whereas Procedures can have input/output parameters . Function takes one input parameter it is mandatory but Stored Procedure may take o to n input parameters.. Functions can be called from Procedure whereas Procedures cannot be called from Function. Advance Difference Procedure allows SELECT as well as DML(INSERT/UPDATE/DELETE) statement in it whereas Function allows only SELECT statement in it. Procedures can not be utilized in a SELECT statement whereas Function can be embedded in a SELECT statement. Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section whereas Function can be. Functions that return tables can be treated as another rowset. This can be used in JOINs with other tables. Inline Function can be though of as views that take parameters and can be used in JOINs and other Rowset operations. Exception can be handled by try-catch block in a Procedure whereas try-catch block cannot be used in a Function. We can go for Transaction Management in Procedure whereas we can't go in Function.Original link: http://www.dotnet-tricks.com/Tutorial/sqlserver/7EDL150912-Difference-between-Stored-Procedure-and-Function-in-SQL-Server.html

    • 0
  • Munesh Sharma
    Apr, 2014 22

    http://www.dotnet-tricks.com/Tutorial/sqlserver/7EDL150912-Difference-between-Stored-Procedure-and-Function-in-SQL-Server.html

    • 0
  • Ravi Patel
    Apr, 2014 19

    Stored Procedures 1. Can be used to read and modify data. 2. Can use used with XML FOR clause 3. Can use a UDF inside a SP in SELECT statement. 4. Cannot be used to create constraints while creating a table. function 1.Can only read data, cannot modify the database 2. - Cannot be used with XML FOR clause 3.Cannot execute an SP inside a UDF. 4 Can be used to create Constraints while creating a table. 5 Cannot execute some non-deterministic built-in functions, like GETDATE().

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS