Skip to main content

Difference between SQL Function and Stored Procedure

The main difference between functions and stored procedures  are given bellow:
Function(User Defined)
  1. It returns only one value
  2. We can’t use transaction in function
  3. Only have input parameter
  4. We can’t called SP from function
  5. We can’t use exception handling using Try-Catch block in function
  6. We can use function in select/where/having statement
Stored Procedure (Store Procedure)
  1. It returns zero, single or multiple values
  2. We can use transaction in SP
  3. Can have input/output parameter
  4. We can called function from SP
  5. We can use exception handling using Try-Catch block in SP
  6. We can’t use SP in select/where/having statement

Comments

Popular posts from this blog

Sql CharIndex Function

The CHARINDEX  function returns the starting position of the specified expression in a character string. Example: Search for "t" in string "DotNetReceipe", and return position: SELECT CHARINDEX( 't' , 'DotNetReceipe' ) AS Position;

Export html table to csv using javascript

<table>     <tr><th>Name</th><th>Age</th><th>Country</th></tr>     <tr><td>MANOJ</td><td>26</td><td>INDIA</td></tr>     <tr><td>KRISHAN</td><td>19</td><td>INDIA</td></tr>     <tr><td>SUSHEEL</td><td>32</td><td>INDIA</td></tr> </table> <button onclick="Export_CSV ()">Export HTML table to CSV file</button> function download_csv(csv, filename) {     var csvFile;     var downloadLink;     csvFile = new Blob([csv], {type: "text/csv"});     downloadLink = document.createElement("a");     downloadLink.download = filename;     downloadLink.href = window.URL.createObjectURL(csvFile);     downloadLink.style.d...