What is difference between stored procedure and function?

Answers were Sorted based on User's Feedback



What is difference between stored procedure and function?..

Answer / rakesh

mojor difference is
function must return a value but a
procedure may or may not return a value

Is This Answer Correct ?    8 Yes 1 No

What is difference between stored procedure and function?..

Answer / a.suresh

1.Stored Procedure return 0 to nth value where as function
return only one value which is must.
2.we can't use the stored procedure in select select
statement where as function can be used in the select statement.
3.we can use all the dml(insert,update,delete) commands in
stored procedure where as select statement only used in
functions.
4.we can use try catch in stored procedure where as in
functions cant.
function must be used with its schema where as stored
procedure used with out schema name
ex.dbo.function name

Is This Answer Correct ?    2 Yes 0 No

What is difference between stored procedure and function?..

Answer / g.ashok

Stored Procedure need not to return a value.
Function should return a value.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More SQL Server Interview Questions

What is difference between index seek vs. Index scan?

0 Answers  


How to skip remaining statements in a loop block using continue statements?

0 Answers  


What is difference between joins and subqueries?

0 Answers  


Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?

2 Answers  


Which tcl commands are available on the sql server?

0 Answers  


hi to all teachers,... Friends who write in the query mode Full text Search in Sql Server have experience Who make(Convert) this Stored Procedure as a normal Full text Search, which contains and .. Is used, into Advance of the tips I have thanked all friends perfection. Email : rezaafandi@yahoo.com Create PROCEDURE Sp_student @fname varchar(50), @lname varchar(50), @tel varchar(50), @code varchar(50), @adr varchar(50), @search_operation varchar(50), @totalRowCount bigint output AS begin if @search_operation = 'and' begin SELECT f3,f4,f5,f6,f7 FROM tb_student WHERE( f5 like '%' + @fname + '%' and f4 like '%' + @lname + '%' and f6 like '%' + @tel + '%' and f7 like '%' + @code + '%' and f3 like '%' + @adr +'%' ) select @totalRowCount = @@rowcount end

0 Answers  


How column data types are determined in a view?

0 Answers  


How to create new tables with "create table" statements in ms sql server?

0 Answers  


What are alternate keys?

0 Answers  


What do you understand by a view? What does the with check option clause for a view do?

0 Answers  


What action plan is preferred if sql server is not responding?

0 Answers  


What are “phantom rows”?

0 Answers  


Categories