Search This Blog

Thursday, January 13, 2011

QUIZ



1.  alter FUNCTION Jtotalfaktur
(
      @tglawal datetime,
      @tglakhir datetime
)
RETURNS money
AS
BEGIN
      -- Declare the return variable here
      DECLARE @result money
      -- Add the T-SQL statements to compute the return value here
      SELECT @result = sum(TotalFaktur) from FJ
      where @result between @tglawal and @tglakhir +'23:59:59'

      -- Return the result of the function
      RETURN @result

END
GO

print dbo.Jtotalfaktur('2005-05-18','2005-06-20')


2.  create FUNCTION JumlahPelanggan
(
      @tglawal datetime,
      @tglakhir datetime
)
RETURNS integer
AS
BEGIN
      -- Declare the return variable here
      DECLARE @result integer
      -- Add the T-SQL statements to compute the return value here
      SELECT @result = count(distinct (kodepelanggan))from FJ
      where tglfj between @tglawal and @tglakhir +'23:59:59'

      -- Return the result of the function
      RETURN @result

END
GO

print dbo.JumlahPelanggan('2005-06-01','2005-06-30')





No comments:

Post a Comment