Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 functions vs proc???

Author  Topic 

kumar.sqldba
Starting Member

6 Posts

Posted - 2007-08-13 : 15:47:37
Hi All

What are they difference between FUNCTIONS and PROCEDURE?

Thanks in Advance...

Waiting for your replies...

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-08-13 : 16:01:02
JUST GOOGLE IT!

http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1063700,00.html

Ashley Rhodes
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-13 : 22:09:30
Or check sql books online.
Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2007-08-13 : 22:43:15
Just a few:

A scalar UDF can be used

in a check constraint to enforce cross db contraints.
in INLINE (ex: Select dbo.ThisFunctionAddsTwoColumns(cola,colb) from tableX


A table valued UDF can be used
in FROM clause Select dbo.ThisFunctionAddsTwoColumns(cola,colb) from dbo.ThisFunctionReturnsATable A inner join dbo.ThisFunctionReturnsAnotherTable B on A.col1 = B.col2

in a where clause
where dbo.ColumnAisLessThanColumnB(cola,colb)


see here
http://www.sqlteam.com/article/user-defined-functions
Go to Top of Page

mageshks
Yak Posting Veteran

59 Posts

Posted - 2007-08-14 : 03:08:21
you cannot have DMLs in UDF.But procedures can have.
Go to Top of Page
   

- Advertisement -