What are the differences between stored procedure and
functions in SQL Server 2000?

Answer Posted / pavan pareta

1) functions are used for computations where as procedures
can be used for performing business logic
2) functions MUST return a value, procedures need not be.
3) you can have DML(insert, update, delete) statements in a
function. But, you cannot call such a function in a SQL
query..eg: suppose, if u have a function that is updating a
table.. you can't call that function in any sql query.-
select myFunction(field) from sometable; will throw error.
4) function parameters are always IN, no OUT is possible

Is This Answer Correct ?    145 Yes 43 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the steps to take to improve performance of a poor performing query? : sql server database administration

600


Where actually sql azure database is hosted?

149


How to configure and test odbc dsn settings?

577


1)what is the difference between Reinitializing a Subscription and synchronization the subscription? 2)when to use reinitializing ? 3)when to use synchronization? 4)when adding table or deleting a table what to do?(reinz.. or syn) 5)when adding a column what to do?

1542


What are the security related catalog views? : sql server security

538






What is the difference between clustered index and primary key?

508


Are there any preferred steps that need to be taken care of before starting the installation of sql server 2000?

581


What is difference between views and tables?

470


Why and when do stored procedure recompile?

546


Can we write trigger for view?

561


What are different types of schemas?

523


What is lock escalation? : sql server database administration

599


What is the difference between seek predicate and predicate?

590


How can you transfer data from a text file to a database table? Or how can you export data from a table to a comma delimited (csv) file? Or how can you import data from ms access to a table in a database? Or how can you export data from a table to an excel file?

571


How to truncate the log in sql server 2012? : sql server database administration

579