Created
March 1, 2016 09:22
-
-
Save radityopw/a5de78c2b747282b0b84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use tempdb | |
go | |
-- membuat functions | |
CREATE FUNCTION dbo.minimum(@nilai1 float, @nilai2 float) | |
returns float | |
as | |
begin | |
declare @min float | |
set @min = @nilai1 | |
if @nilai2 < @nilai1 | |
begin | |
set @min = @nilai2 | |
end | |
return @min | |
end | |
go | |
-- menjalankan stored procedure dan melihat hasilnya | |
select SalesOrderID,SubTotal,Freight, dbo.minimum(subtotal,freight) as min_nilai from AdventureWorks2012.sales.SalesOrderHeader | |
-- menghapus | |
DROP function [dbo].[minimum] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment