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
Explain in details security in SQL azure?
Difference Between ORDER BY Clause and GROUP BY Clause in SQL?
If a user does not have permission to a table, but has permission to a view created on it, will he be able to view the data in table?
How to apply filtering criteria at group level with the having clause in ms sql server?
Write a SQL queries on Self Join and Inner Join.
What are orphan records?
What are the operating modes in which database mirroring runs?
Can we do dml on views?
Can truncate be rolled back?
What are the new features introduced in SQL Server 2000? What changed between the previous version of SQL Server and the current version?
What is the sql case statement used for? Explain with an example?
What are the types of indexes?
What is compression - row-level and page-level compression?
What is the stuff?
Explain stored procedure?