Description
Properties
| Name | Value |
|---|---|
| ANSI Nulls ON | True |
| Quoted Identifier ON | True |
| Encrypted | False |
| Execute As | |
| Null on Null Input | False |
| Schema Bound | False |
| Assembly |
Parameters
| Name | Data Type | Length | Description |
|---|---|---|---|
| (Result) | varchar | 255 | |
| @dateIn | datetime | 8 |
SQL Script
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
CREATE FUNCTION dbo.dateToIndStrBCP (@dateIn datetime)
RETURNS varchar(255)
WITH EXECUTE AS CALLER
AS
BEGIN
declare @StrResult varchar(255)
set @StrResult=''
declare @bulan int
declare @hari int
declare @hariKe int
declare @tahun int
declare @namaBulan varchar(255)
declare @namaHari varchar(255)
set @tahun= datepart(YYYY, @dateIn)
set @bulan = datepart (MM , @dateIn)
set @hari = datepart(DD, @dateIn )
set @hariKe = datepart(dw, @dateIn )
set @namaBulan=case
when @bulan=1 then 'Januari'
when @bulan=2 then 'Februari'
when @bulan=3 then 'Maret'
when @bulan=4 then 'April'
when @bulan=5 then 'Mei'
when @bulan=6 then 'Juni'
when @bulan=7 then 'Juli'
when @bulan=8 then 'Agustus'
when @bulan=9 then 'September'
when @bulan=10 then 'Oktober'
when @bulan=11 then 'November'
when @bulan=12 then 'Desember'
else ''
end
set @namaHari=case
when @hariKe=1 then 'Minggu'
when @hariKe=2 then 'Senin'
when @hariKe=3 then 'Selasa'
when @hariKe=4 then 'Rabu'
when @hariKe=5 then 'Kamis'
when @hariKe=6 then 'Jumat'
when @hariKe=7 then 'Sabtu'
else ''
end
RETURN('Ditutup pada hari '+ @namaHari + ' tanggal ' + replace(space(2-len(@hari)),' ' ,'0') + cast(@hari as varchar(255)) + ' ' + @namaBulan +' '+ cast(@tahun as varchar(255)) )
END;
GO
GO
CREATE FUNCTION dbo.dateToIndStrBCP (@dateIn datetime)
RETURNS varchar(255)
WITH EXECUTE AS CALLER
AS
BEGIN
declare @StrResult varchar(255)
set @StrResult=''
declare @bulan int
declare @hari int
declare @hariKe int
declare @tahun int
declare @namaBulan varchar(255)
declare @namaHari varchar(255)
set @tahun= datepart(YYYY, @dateIn)
set @bulan = datepart (MM , @dateIn)
set @hari = datepart(DD, @dateIn )
set @hariKe = datepart(dw, @dateIn )
set @namaBulan=case
when @bulan=1 then 'Januari'
when @bulan=2 then 'Februari'
when @bulan=3 then 'Maret'
when @bulan=4 then 'April'
when @bulan=5 then 'Mei'
when @bulan=6 then 'Juni'
when @bulan=7 then 'Juli'
when @bulan=8 then 'Agustus'
when @bulan=9 then 'September'
when @bulan=10 then 'Oktober'
when @bulan=11 then 'November'
when @bulan=12 then 'Desember'
else ''
end
set @namaHari=case
when @hariKe=1 then 'Minggu'
when @hariKe=2 then 'Senin'
when @hariKe=3 then 'Selasa'
when @hariKe=4 then 'Rabu'
when @hariKe=5 then 'Kamis'
when @hariKe=6 then 'Jumat'
when @hariKe=7 then 'Sabtu'
else ''
end
RETURN('Ditutup pada hari '+ @namaHari + ' tanggal ' + replace(space(2-len(@hari)),' ' ,'0') + cast(@hari as varchar(255)) + ' ' + @namaBulan +' '+ cast(@tahun as varchar(255)) )
END;
GO
Depends On
No items found
Used By
No items found