-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCustomFunction.sql
37 lines (26 loc) · 908 Bytes
/
CustomFunction.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Create Function KDVhesapla(@fiyat money)
returns money
begin
return @fiyat*1.08
end
go
select ProductName,CategoryName,UnitPrice,
dbo.KDVHesapla( UnitPrice) as [KDV]
from Products P
join Categories C on p.CategoryID=c.CategoryID
order by 4 asc
Create function EmployeeInformation(@employeeId int)
returns table
return select * from Employees Where EmployeeID = @employeeId
select * from dbo.EmployeeInformation(1)
create function OrderQuantity(@started int , @finished int )
returns table
return select * from [Order Details] where Quantity between @started and @finished
select * from OrderQuantity(10,15)
-- Update Function
Alter function OrderQuantity(@started smallint , @finished smallint )
returns table
return select * from [Order Details] where Quantity between @started and @finished
select * from dbo.OrderQuantity(10,20)
--Delete Function
drop function OrderQuantity