Differences between functions and stored procedures?
Answer Posted / samba shiva reddy . m
1. Functions are compiled and executed at run time.
Stored procedures are stored in parsed and compiled format in the database(Pree compiled).
2. Functions cannot affect the state of the database which means we cannot perform insert,delete,update and create operations on the database.
Stored Procedures can affect the state of the database by using insert,delete,update and create operations.
3 Functions are basically used to compute values. We passes some parameters to functions as input and then it performs some operations on the parameter and return output.
Stored procedures are basically used to process the task.
4.Function can not change server environment and our operating system environment.
Stored procedures can change server environment and our operating system environment.
5.Functions can invoked from SQL Statements.
example : select udf from table name
Stored procedures can't invoked from SQL staements.
example : select spname from table name
6.Functions can run an executable file from SQL SELECT or an action query.
operating system use Execute or Exec to run
7.We can use User Defined function in Stored procedure
we can't use stored procedure in UDF.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How to create percentile function?
Mention the differences between having and where clause.
How fixed length strings are truncated and padded?
How to provide values to stored procedure parameters in ms sql server?
What is a scheduled job or what is a scheduled task?
What is the Main Difference between ACCESS and SQL SERVER?
Is null in sql server?
What are the characteristics of modern DBMS?
Do you know what are pages and extents? : SQL Server Architecture
What is the template in sql?
Explain how would you store your query in an SSRS report or a Database server?
What is user defined stored procedures?
what are the reporting service components in SSRS?
Can we run Reporting Services with SQL Server express edition, which is a free version of SQL Server?
Tell me what is the order in which the sql query is executed?