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
 SQL Function

Author  Topic 

pureclass85
Starting Member

29 Posts

Posted - 2009-03-11 : 06:44:33
how do i create my own sql function?
so that when used like this

select myfunction(data1) from table 1

thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-03-11 : 06:49:47
Books Online says


CREATE FUNCTION dbo.myFunction
(
@p INT
)
RETURNS INT
AS
BEGIN
RETURN @p * @p
END



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

pureclass85
Starting Member

29 Posts

Posted - 2009-03-11 : 08:31:26
k thnaks can you give an example of how it opperates?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-11 : 13:27:55
http://www.sqlteam.com/article/user-defined-functions
Go to Top of Page
   

- Advertisement -