.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

Difference between Store Procedure and function?

Posted By :Narayanan     Posted Date :July 22, 2011    Points :40   Category :Sql Server 
S.No Store Procedure Function
1. Return Null or Value Return Value
2. Input,OutPut Parameter Input Parameter
3. Call independently Call SQL Statement
4. Not called from Function Called from Procedure

You can also find related Interview Question to Difference between Store Procedure and function?  below: 

whats the difference between a stroed procedure and a user defined function

  
udf ll return only one output parameter where as sp returns more(2100 not sure)

udf are called directly by their name in a pgm where as exec spname
is used to execcute an sp (More...)

Difference between Function and Stored Procedure?

  
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables.
Inline UDF's can be though of as views that take parameters and can be used in JOINs and other Rowset operations.
(More...)

What is Difference between Function and Stored Procedure?

  
UDF can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be. UDFs that return tables can be treated as another rowset. This can be used in JOINs with other tables. Inline UDF's can be thought of as views that take parameters and can be used in JOINs and other Rowset operations. (More...)

Database: Difference between Function and stored procedure?

  

Function can be used in sql statements anywhere in where/select/having etc. where as stored procedure cannot be.
(More...)

Difference between stored procedure and function

  

1.Function must return a value but Stored Procedure can return 0(Zero) or n values
2.Functions have only input parameters but Procedures can have either input or output or both parameters .
3.Function must have one input parameter which is mandatory but 4.Stored Procedure may take 0 (Zero) to n input parameters.
5.Functions can be called from Procedure whereas Procedures cannot be called from Function.
6.Procedure contains DML statement whereas function allows only select statement.
6.Exception handling can be done in stored Procedure only (More...)

What is the difference between stored procedure and function.

  
Below is main differences between two.
1) Procedure can return zero or n values whereas function can return one value which is mandatory.
2) Procedures can have input, output parameters for it whereas functions can have only input parameters.
3) Procedure allows select as well as DML statement in it whereas function allows only select statement in it.
4) Functions can be called from procedure whereas procedures cannot be called from function.
5) Exception can be handled by try-catch block in a procedure whereas try-catch block cannot be used in a function.
6) We can go for transaction management in procedure whereas we can't go in function.
7) Procedures cannot be utilized in a select statement whereas function can be embedded in a select statement. (More...)

Difference between a sub and a function.

  
A Sub Procedure is a method will not return a value
-A sub procedure will be defined with a "Sub" keyword
Sub ShowName(ByVal myName As String)
Console.WriteLine("My name is: " & myName)
End Sub
-A function is a method that will return value(s).
-A function will be defined with a "Function" keyword
Function FindSum(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Dim sum As Integer = num1 + num2
Return sum
End Function (More...)

What is the difference between "dynamic SQL" and "stored procedure" ?

  
Dynamic sql is the bunch of statements that dynamically constructed at run time and not stored in database.
Where as Stored procedures are stored in data base in complied form. (More...)

Main Difference between Method and function?

  
Method which tied to a class where as function need not to be. In OOPS we can say there is no functions concept because all the method is tied to a class.

Function is available in procedural language, Scripting language that why we say JavaScript function etc. (More...)

Difference between Len and DataLength function in Sql Server?

  
LEN() function will not count the trailing spaces.

DATALENGTH() function will count the trailing function

example:

DECLARE @MyString VARCHAR(50)
SET @MyString = 'alwyn '
SELECT LEN(@MyString) AS LenFunction
SELECT DATALENGTH(@MyString) AS DataLength

LenFunction:
5

DataLength:
8 (More...)

Database: Difference between stored procedure and trigger?

  
.Stored procedure are called explicitly where as trigger are called implicitly.
.Stored procedure are not attached to specific table where as triggers are attached to specific table.
.Stored procedure are called by invoking a CALL to it where this does not applies in case of trigger.


(More...)

what is store Procedure(SP)?

  
Its nothing but a set of T-SQL statements combined to perform a single task of several tasks. (More...)

What is the Difference between subroutine and function In VB Script

  
Function Should Return a Value

Subroutine does not return any Value (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend