Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
0 of .
Results for:
P. 1
Function SQL Terbilang Rupiah, Dolar, Umur

# Function SQL Terbilang Rupiah, Dolar, Umur

Ratings: (0)|Views: 36|Likes:
Function SQL Terbilang Rupiah, Dolar, Umur
Function SQL Terbilang Rupiah, Dolar, Umur

Categories:Types, School Work

### Availability:

See more
See less

04/08/2015

pdf

text

original

Welcome to SQL
Function
terbilang (rupiah & dolar)
Function
terbilang umur
Abdul Gani Putras

CREATE function [dbo].[terbilang] (@nilai bigint) RETURNS varchar(1024) AS BEGIN DECLARE @hasil varchar(1024),@x bigint DECLARE @angka TABLE ( kode int, ket varchar(20)) INSERT INTO @angka VALUES(0,'') INSERT INTO @angka VALUES(1,'Satu') INSERT INTO @angka VALUES(2,'Dua') INSERT INTO @angka VALUES(3,'Tiga') INSERT INTO @angka VALUES(4,'Empat') INSERT INTO @angka VALUES(5,'Lima') INSERT INTO @angka VALUES(6,'Enam') INSERT INTO @angka VALUES(7,'Tujuh') INSERT INTO @angka VALUES(8,'Delapan') INSERT INTO @angka VALUES(9,'Sembilan') INSERT INTO @angka VALUES(10,'Sepuluh') INSERT INTO @angka VALUES(11,'Sebelas') IF @nilai <12 SET @hasil = (SELECT ket FROM @angka WHERE kode=@nilai) ELSE IF @nilai <20 BEGIN SET @x = @nilai - 10 SET @hasil = (SELECT ket FROM @angka WHERE kode=@x) + ' Belas' END ELSE IF @nilai <100 BEGIN SET @x = @nilai / 10 SET @hasil = (SELECT ket FROM @angka WHERE kode=@x) + ' Puluh ' SET @x = @nilai % 10 SET @hasil = @hasil + (SELECT ket FROM @angka WHERE kode=@x) END ELSE IF @nilai <200 BEGIN SET @x = @nilai - 100 SET @hasil = 'Seratus ' + dbo.terbilang(@x) END ELSE IF @nilai <1000 BEGIN SET @x = @nilai / 100 SET @hasil = dbo.terbilang(@x) + ' Ratus ' SET @x = @nilai % 100 SET @hasil = @hasil + dbo.terbilang(@x) END ELSE IF @nilai <2000

BEGIN SET @x = @nilai - 1000 SET @hasil = 'Seribu ' + dbo.terbilang(@x) END ELSE IF @nilai <1000000 BEGIN SET @x = @nilai / 1000 SET @hasil = dbo.terbilang(@x) + ' Ribu ' SET @x = @nilai % 1000 SET @hasil = @hasil + dbo.terbilang(@x) END ELSE IF @nilai <1000000000 BEGIN SET @x = @nilai / 1000000 SET @hasil = dbo.terbilang(@x) + ' Juta ' SET @x = @nilai % 1000000 SET @hasil = @hasil + dbo.terbilang(@x) END ELSE IF @nilai <1000000000000 BEGIN SET @x = @nilai / 1000000000 SET @hasil = dbo.terbilang(@x) + ' Milyar ' SET @x = @nilai % 1000000000 SET @hasil = @hasil + dbo.terbilang(@x) END ELSE IF @nilai <1000000000000000 BEGIN SET @x = @nilai / 1000000000000 SET @hasil = dbo.terbilang(@x) + ' Trilyun ' SET @x = @nilai % 1000000000000 SET @hasil = @hasil + dbo.terbilang(@x) END ELSE SET @hasil = 'N/A' RETURN @hasil END