xxxxxxxxxx
CREATE FUNCTION Fact (@parameter datatype)
RETURNS returndatatype
AS
BEGIN
--sql statements
RETURN --whatever you want to return but of returndatatype from above
END
xxxxxxxxxx
ID | WebsiteName |
-----------------------------------
1 | www.yahoo.com |
2 | www.google.com |
3 | www.youtube.com |
CREATE FUNCTION dbo.StripWWWandCom (@input VARCHAR(250))
RETURNS VARCHAR(250)
AS BEGIN
DECLARE @Work VARCHAR(250)
SET @Work = @Input
SET @Work = REPLACE(@Work, 'www.', '')
SET @Work = REPLACE(@Work, '.com', '')
RETURN @work
END
/* Running function */
SELECT ID, dbo.StripWWWandCom (WebsiteName)
FROM dbo.YourTable ..
ID | WebsiteName
--------------------------
1 | yahoo
xxxxxxxxxx
Create Function Fn_ToplamaYap(@sayi1 int,@sayi2 int)
Returns int
As
Begin
Declare @toplam int
Set @toplam = @sayi1+ @sayi2
return @toplam
End