Say, as in Roman Calendar

>>Script Language and Platform: SQL Server
This script will display the day of the month as in Roman Julian calendar

Usage:

select dbo.udf_RomanDay (’02/28/2004′)
–results
pridie Kal.Mar.

select dbo.udf_RomanDay (’12/01/2004′)
–results
Kalendae Decembres

select dbo.udf_RomanDay (’11/13/2004′)
–results
Idus Novembres

Author: MAK



Create function dbo.udf_RomanDay (@date datetime)
returns varchar(100)
as
begin
–Objective: To display day of the month as in Roman Calendar
–Created by: MAK
–Date : July 16, 2004

declare @monthval int
set @monthval =month(@date)
declare @dayval int
set @dayval=day(@date)
declare @romanday varchar(100)

if @monthval =1
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Januariae’
When 2 then ‘a.d.IV.Non.Jan’
When 3 then ‘a.d.III.Non.Jan.’
When 4 then ‘pridie Non.Jan.’
When 5 then ‘Nonae Januariae’
When 6 then ‘a.d.VIII.Id.Jan.’
When 7 then ‘a.d.VII. Id.Jan.’
When 8 then ‘a.d.VI. Id.Jan.’
When 9 then ‘a.d.V. Id.Jan.’
When 10 then ‘a.d.IV. Id.Jan.’
When 11 then ‘a.d.III. Id.Jan.’
When 12 then ‘pridie Id.Jan.’
When 13 then ‘Idus Januariae’
When 14 then ‘a.d.XIX.Kal.Feb.’
When 15 then ‘a.d.XVIII.Kal.Feb.’
When 16 then ‘a.d.XVII.Kal.Feb.’
When 17 then ‘a.d.XVI.Kal.Feb.’
When 18 then ‘a.d.XV.Kal.Feb.’
When 19 then ‘a.d.XIV.Kal.Feb.’
When 20 then ‘. a.d.XIII.Kal.Feb.’
When 21 then ‘a.d.XII.Kal.Feb.’
When 22 then ‘a.d.XI.Kal.Feb.’
When 23 then ‘a.d.X.Kal.Feb.’
When 24 then ‘a.d.IX.Kal.Feb.’
When 25 then ‘a.d.VIII.Kal.Feb.’
When 26 then ‘a.d.VII.Kal.Feb.’
When 27 then ‘a.d.VI.Kal.Feb.’
When 28 then ‘a.d.V.Kal.Feb.’
When 29 then ‘a.d.IV.Kal.Feb.’
When 30 then ‘a.d.III.Kal.Feb.’
When 31 then ‘pridie Kal.Feb.’
end
end

if @monthval =2
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Februariae’
When 2 then ‘a.d.IV.Non.Feb.’
When 3 then ‘a.d.III.Non.Feb.’
When 4 then ‘pridie Non. Feb.’
When 5 then ‘Nonae Februariae’
When 6 then ‘a.d.VIII.Id.Feb.’
When 7 then ‘a.d.VII.Id.Feb.’
When 8 then ‘a.d.VI.Id.Feb’
When 9 then ‘a.d.V.Id.Feb.’
When 10 then ‘a.d.IV.Id.Feb.’
When 11 then ‘a.d.III.Id.Feb.’
When 12 then ‘pridie Id. Feb.’
When 13 then ‘Idus Februariae’
When 14 then ‘a.d.XVI.Kal.Mar.’
When 15 then ‘a.d.XV.Kal.Mar.’
When 16 then ‘a.d.XIV.Kal.Mar.’
When 17 then ‘a.d.XIII.Kal.Mar.’
When 18 then ‘a.d.XII.Kal.Mar.’
When 19 then ‘a.d.XI.Kal.Mar.’
When 20 then ‘a.d.X.Kal.Mar.’
When 21 then ‘a.d.IX.Kal.Mar.’
When 22 then ‘a.d.VIII.Kal.Mar.’
When 23 then ‘a.d.VII.Kal.Mar.’
When 24 then ‘a.d.VI.Kal.Mar.’
When 25 then ‘a.d.V.Kal.Mar.’
When 26 then ‘a.d.IV.Kal.Mar.’
When 27 then ‘a.d.III.Kal.Mar.’
When 28 then ‘pridie Kal.Mar.’
When 28 then NULL
end
end

if @monthval =3
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Martiae’
When 2 then ‘a.d.VI.Non.Mar.’
When 3 then ‘a.d.V.Non.Mar.’
When 4 then ‘a.d.IV.Non.Mar.’
When 5 then ‘a.d.III.Non.Mar.’
When 6 then ‘pridie Non.Mar.’
When 7 then ‘Nonae Martiae’
When 8 then ‘a.d.VIII.Id.Mar.’
When 9 then ‘a.d.VII.Id.Mar.’
When 10 then ‘a.d.VI.Id.Mar.’
When 11 then ‘a.d.V.Id.Mar.’
When 12 then ‘a.d.IV.Id.Mar.’
When 13 then ‘a.d.III.Id.Mar.’
When 14 then ‘pridie Id.Mar.’
When 15 then ‘Idus Martiae’
When 16 then ‘a.d.XVII.Kal.Apr.’
When 17 then ‘a.d.XVI.Kal.Apr.’
When 18 then ‘a.d.XV.Kal.Apr.’
When 19 then ‘a.d.XIV.Kal.Apr.’
When 20 then ‘a.d.XIII.Kal.Apr.’
When 21 then ‘a.d.XII.Kal.Apr.’
When 22 then ‘a.d.XI.Kal.Apr.’
When 23 then ‘a.d.X.Kal.Apr.’
When 24 then ‘a.d.IX.Kal.Apr.’
When 25 then ‘a.d.VIII.Kal.Apr.’
When 26 then ‘a.d.VII.Kal.Apr.’
When 27 then ‘a.d.VI.Kal.Apr.’
When 28 then ‘a.d.V.Kal.Apr.’
When 29 then ‘a.d.IV.Kal.Apr.’
When 30 then ‘a.d.III.Kal.Apr.’
When 31 then ‘pridie Kal.Apr.’
end
end

if @monthval =4
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Apriles’
When 2 then ‘a.d.IV.Non.Apr.’
When 3 then ‘a.d.III.Non.Apr.’
When 4 then ‘pridie Non.Apr.’
When 5 then ‘Nonae Apriles’
When 6 then ‘a.d.VIII.Id.Apr.’
When 7 then ‘a.d.VII.Id.Apr.’
When 8 then ‘a.d.VI.Id.Apr.’
When 9 then ‘a.d.V.Id.Apr.’
When 10 then ‘a.d.IV.Id.Apr.’
When 11 then ‘a.d.III.Id.Apr.’
When 12 then ‘pridie Id.Apr.’
When 13 then ‘Idus Apriles’
When 14 then ‘a.d.XVIII.Kal.Mai.’
When 15 then ‘a.d.XVII.Kal.Mai.’
When 16 then ‘a.d.XVI.Kal.Mai.’
When 17 then ‘a.d.XV.Kal.Mai.’
When 18 then ‘a.d.XIV.Kal.Mai.’
When 19 then ‘a.d.XIII.Kal.Mai.’
When 20 then ‘a.d.XII.Kal.Mai.’
When 21 then ‘a.d.XI.Kal.Mai.’
When 22 then ‘a.d.X.Kal.Mai.’
When 23 then ‘a.d.IX.Kal.Mai.’
When 24 then ‘a.d.VIII.Kal.Mai.’
When 25 then ‘a.d.VII.Kal.Mai.’
When 26 then ‘a.d.VI.Kal.Mai.’
When 27 then ‘a.d.V.Kal.Mai.’
When 28 then ‘a.d.IV.Kal.Mai.’
When 29 then ‘a.d.III.Kal.Mai.’
When 30 then ‘pridie Kal.Mai.’
end
end

if @monthval =5
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Maiae’
When 2 then ‘a.d.VI.Non.Mai.’
When 3 then ‘a.d.V.Non.Mai.’
When 4 then ‘a.d.IV.Non.Mai.’
When 5 then ‘a.d.III.Non.Mai.’
When 6 then ‘pridie Non.Mai.’
When 7 then ‘Nonae Maiae’
When 8 then ‘a.d.VIII.Id.Mai.’
When 9 then ‘a.d.VII.Id.Mai.’
When 10 then ‘a.d.VI.Id.Mai.’
When 11 then ‘a.d.V.Id.Mai.’
When 12 then ‘a.d.IV.Id.Mai.’
When 13 then ‘a.d.III.Id.Mai.’
When 14 then ‘pridie Id.Mai.’
When 15 then ‘Idus Maiae’
When 16 then ‘a.d.XVII.Kal.Jun.’
When 17 then ‘a.d.XVI.Kal.Jun.’
When 18 then ‘a.d.XV.Kal.Jun.’
When 19 then ‘a.d.XIV.Kal.Jun.’
When 20 then ‘a.d.XIII.Kal.Jun.’
When 21 then ‘a.d.XII.Kal.Jun.’
When 22 then ‘a.d.XI.Kal.Jun.’
When 23 then ‘a.d.X.Kal.Jun.’
When 24 then ‘a.d.IX.Kal.Jun.’
When 25 then ‘a.d.VIII.Kal.Jun.’
When 26 then ‘a.d.VII.Kal.Jun.’
When 27 then ‘a.d.VI.Kal.Jun.’
When 28 then ‘a.d.V.Kal.Jun.’
When 29 then ‘a.d.IV.Kal.Jun.’
When 30 then ‘a.d.III.Kal.Jun.’
When 31 then ‘pridie Kal.Jun.’
end
end

if @monthval =6
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Juniae’
When 2 then ‘a.d.IV.Non.Jun.’
When 3 then ‘a.d.III.Non.Jun.t’
When 4 then ‘pridie Non.Jun.’
When 5 then ‘Nonae Juniae’
When 6 then ‘a.d.VIII.Id.Jun.’
When 7 then ‘a.d.VII.Id.Jun.’
When 8 then ‘a.d.VI.Id.Jun.’
When 9 then ‘a.d.V.Id.Jun.’
When 10 then ‘a.d.IV.Id.Jun.’
When 11 then ‘a.d.III.Id.Jun.’
When 12 then ‘pridie Id.Jun.’
When 13 then ‘Idus Juniae’
When 14 then ‘a.d.XVIII.Kal.Jul.’
When 15 then ‘a.d.XVII.Kal.Jul.’
When 16 then ‘a.d.XVI.Kal.Jul.’
When 17 then ‘a.d.XV.Kal.Jul.’
When 18 then ‘a.d.XIV.Kal.Jul.’
When 19 then ‘a.d.XIII.Kal.Jul.’
When 20 then ‘a.d.XII.Kal.Jul.’
When 21 then ‘a.d.XI.Kal.Jul.’
When 22 then ‘a.d.X.Kal.Jul.’
When 23 then ‘a.d.IX.Kal.Jul.’
When 24 then ‘a.d.VIII.Kal.Jul.’
When 25 then ‘a.d.VII.Kal.Jul.’
When 26 then ‘a.d.VI.Kal.Jul.’
When 27 then ‘a.d.V.Kal.Jul.’
When 28 then ‘a.d.IV.Kal.Jul.’
When 29 then ‘a.d.III.Kal.Jul.’
When 30 then ‘pridie Kal.Jul.’
end
end

if @monthval =7
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Juliae’
When 2 then ‘a.d.VI.Non.Jul.’
When 3 then ‘a.d.V.Non.Jul.’
When 4 then ‘a.d.IV.Non.Jul.’
When 5 then ‘a.d.III.Non.Jul.’
When 6 then ‘pridie Non.Jul.’
When 7 then ‘Nonae Juliae’
When 8 then ‘a.d.VIII.Id.Jul.’
When 9 then ‘a.d.VII.Id.Jul.’
When 10 then ‘a.d.VI.Id.Jul.’
When 11 then ‘a.d.V.Id.Jul.’
When 12 then ‘a.d.IV.Id.Jul.’
When 13 then ‘a.d.III.Id.Jul.’
When 14 then ‘pridie Id.Jul.’
When 15 then ‘Idus Juliae’
When 16 then ‘a.d.XVII.Kal.Aug.’
When 17 then ‘a.d.XVI.Kal.Aug.’
When 18 then ‘a.d.XV.Kal.Aug.’
When 19 then ‘a.d.XIV.Kal.Aug.’
When 20 then ‘a.d.XIII.Kal.Aug.’
When 21 then ‘a.d.XII.Kal.Aug.’
When 22 then ‘a.d.XI.Kal.Aug.’
When 23 then ‘a.d.X.Kal.Aug.’
When 24 then ‘a.d.IX.Kal.Aug.’
When 25 then ‘a.d.VIII.Kal.Aug.’
When 26 then ‘a.d.VII.Kal.Aug.’
When 27 then ‘a.d.VI.Kal.Aug.’
When 28 then ‘a.d.V.Kal.Aug.’
When 29 then ‘a.d.IV.Kal.Aug.’
When 30 then ‘a.d.III.Kal.Aug.’
When 31 then ‘pridie Kal.Aug.’
end
end

if @monthval =8
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Augustae’
When 2 then ‘a.d.IV.Non.Aug.’
When 3 then ‘a.d.III.Non.Aug.’
When 4 then ‘pridie Non.Aug.’
When 5 then ‘Nonae Augustae’
When 6 then ‘a.d.VIII.Id.Aug.’
When 7 then ‘a.d.VII.Id.Aug.’
When 8 then ‘a.d.VI.Id.Aug.’
When 9 then ‘a.d.V.Id.Aug.’
When 10 then ‘a.d.IV.Id.Aug.’
When 11 then ‘a.d.III.Id.Aug.’
When 12 then ‘pridie Id.Aug.’
When 13 then ‘Idus Augustae’
When 14 then ‘a.d.XIX.Kal.Sept.’
When 15 then ‘a.d.XVIII.Kal.Sept.’
When 16 then ‘a.d.XVII.Kal.Sept.’
When 17 then ‘a.d.XVI.Kal.Sept.’
When 18 then ‘a.d.XV.Kal.Sept.’
When 19 then ‘a.d.XIV.Kal.Sept.’
When 20 then ‘a.d.XIII.Kal.Sept.’
When 21 then ‘a.d.XII.Kal.Sept.’
When 22 then ‘a.d.XI.Kal.Sept.’
When 23 then ‘a.d.X.Kal.Sept.’
When 24 then ‘a.d.IX.Kal.Sept.’
When 25 then ‘a.d.VIII.Kal.Sept.’
When 26 then ‘a.d.VII.Kal.Sept.’
When 27 then ‘a.d.VI.Kal.Sept.’
When 28 then ‘a.d.V.Kal.Sept.’
When 29 then ‘a.d.IV.Kal.Sept.’
When 30 then ‘a.d.III.Kal.Sept.’
When 31 then ‘pridie Kal.Sept.’
end
end

if @monthval =9
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Septembres’
When 2 then ‘a.d.IV.Non.Sept.’
When 3 then ‘a.d.III.Non.Sept.’
When 4 then ‘pridie Non.Sept.’
When 5 then ‘Nonae Septembres’
When 6 then ‘a.d.VIII.Id.Sept.’
When 7 then ‘a.d.VII.Id.Sept.’
When 8 then ‘a.d.VI.Id.Sept.’
When 9 then ‘a.d.V.Id.Sept.’
When 10 then ‘a.d.IV.Id.Sept.’
When 11 then ‘a.d.III.Id.Sept.’
When 12 then ‘pridie Id.Sept.’
When 13 then ‘Idus Septembres’
When 14 then ‘a.d.XVIII.Kal.Oct.’
When 15 then ‘a.d.XVII.Kal.Oct.’
When 16 then ‘a.d.XVI.Kal.Oct.’
When 17 then ‘a.d.XV.Kal.Oct.’
When 18 then ‘a.d.XIV.Kal.Oct.’
When 19 then ‘a.d.XIII.Kal.Oct.’
When 20 then ‘a.d.XII.Kal.Oct.’
When 21 then ‘a.d.XI.Kal.Oct’
When 22 then ‘a.d.X.Kal.Oct.’
When 23 then ‘a.d.IX.Kal.Oct.’
When 24 then ‘a.d.VIII.Kal.Oct.’
When 25 then ‘a.d.VII.Kal.Oct.’
When 26 then ‘a.d.VI.Kal.Oct.’
When 27 then ‘a.d.V.Kal.Oct.’
When 28 then ‘a.d.IV.Kal.Oct.’
When 29 then ‘a.d.III.Kal.Oct.’
When 30 then ‘pridie Kal.Oct.’
end
end

if @monthval =10
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Octobres’
When 2 then ‘a.d.VI.Non.Oct.’
When 3 then ‘a.d.V.Non.Oct.’
When 4 then ‘a.d.IV.Non.Oct.’
When 5 then ‘a.d.III.Non.Oct.’
When 6 then ‘pridie Non.Oct.’
When 7 then ‘Nonae Octobres’
When 8 then ‘a.d.VIII.Id.Oct.’
When 9 then ‘a.d.VII.Id.Oct.’
When 10 then ‘a.d.VI.Id.Oct.’
When 11 then ‘a.d.V.Id.Oct.’
When 12 then ‘a.d.IV.Id.Oct.’
When 13 then ‘a.d.III.Id.Oct.’
When 14 then ‘pridie Id.Oct.’
When 15 then ‘Idus Octobres’
When 16 then ‘a.d.XVII.Kal.Nov.’
When 17 then ‘a.d.XVI.Kal.Nov.’
When 18 then ‘a.d.XV.Kal.Nov.’
When 19 then ‘a.d.XIV.Kal.Nov.’
When 20 then ‘a.d.XIII.Kal.Nov.’
When 21 then ‘a.d.XII.Kal.Nov.’
When 22 then ‘a.d.XI.Kal.Nov.’
When 23 then ‘a.d.X.Kal.Nov.’
When 24 then ‘a.d.IX.Kal.Nov.’
When 25 then ‘a.d.VIII.Kal.Nov.’
When 26 then ‘a.d.VII.Kal.Nov.’
When 27 then ‘a.d.VI.Kal.Nov.’
When 28 then ‘a.d.V.Kal.Nov.’
When 29 then ‘a.d.IV.Kal.Nov.’
When 30 then ‘a.d.III.Kal.Nov.’
When 31 then ‘pridie Kal.Nov.’
end
end

if @monthval =11
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Novembres’
When 2 then ‘a.d.IV.Non.Nov.’
When 3 then ‘a.d.III.Non.Nov.’
When 4 then ‘pridie Non.Nov.’
When 5 then ‘Nonae Novembres’
When 6 then ‘a.d.VIII.Id.Nov.’
When 7 then ‘a.d.VII.Id.Nov.’
When 8 then ‘a.d.VI.Id.Nov.’
When 9 then ‘a.d.V.Id.Nov.’
When 10 then ‘a.d.IV.Id.Nov.’
When 11 then ‘a.d.III.Id.Nov.’
When 12 then ‘pridie Id.Nov.’
When 13 then ‘Idus Novembres’
When 14 then ‘a.d.XVIII.Kal.Dec.’
When 15 then ‘a.d.XVII.Kal.Dec.’
When 16 then ‘a.d.XVI.Kal.Dec.’
When 17 then ‘a.d.XV.Kal.Dec.’
When 18 then ‘a.d.XIV.Kal.Dec.’
When 19 then ‘a.d.XIII.Kal.Dec.’
When 20 then ‘a.d.XII.Kal.Dec.’
When 21 then ‘a.d.XI.Kal.Dec.’
When 22 then ‘a.d.X.Kal.Dec.’
When 23 then ‘a.d.IX.Kal.Dec.’
When 24 then ‘a.d.VIII.Kal.Dec.’
When 25 then ‘a.d.VII.Kal.Dec.’
When 26 then ‘a.d.VI.Kal.Dec.’
When 27 then ‘a.d.V.Kal.Dec.’
When 28 then ‘a.d.IV.Kal.Dec.’
When 29 then ‘a.d.III.Kal.Dec.’
When 30 then ‘pridie Kal.Dec.’
end
end

if @monthval =12
begin
select @romanday = case @dayval
When 1 then ‘Kalendae Decembres’
When 2 then ‘a.d.IV.Non.Dec.’
When 3 then ‘a.d.III.Non.Dec.’
When 4 then ‘pridie Non.Dec.’
When 5 then ‘Nonae Decembres’
When 6 then ‘a.d.VIII.Id.Dec.’
When 7 then ‘a.d.VII.Id.Dec.’
When 8 then ‘a.d.VI.Id.Dec.’
When 9 then ‘a.d.V.Id.Dec.’
When 10 then ‘a.d.IV.Id.Dec.’
When 11 then ‘a.d.III.Id.Dec.’
When 12 then ‘pridie Id.Dec.’
When 13 then ‘Idus Decembres’
When 14 then ‘a.d.XIX.Kal.Jan.’
When 15 then ‘a.d.XVIII.Kal.Jan.’
When 16 then ‘a.d.XVII.Kal.Jan.’
When 17 then ‘a.d.XVI.Kal.Jan’
When 18 then ‘a.d.XV.Kal.Jan.’
When 19 then ‘a.d.XIV.Kal.Jan.’
When 20 then ‘a.d.XIII.Kal.Jan.’
When 21 then ‘a.d.XII.Kal.Jan.’
When 22 then ‘a.d.XI.Kal.Jan.’
When 23 then ‘a.d.X.Kal.Jan.’
When 24 then ‘a.d.IX.Kal.Jan.’
When 25 then ‘a.d.VIII.Kal.Jan.’
When 26 then ‘a.d.VII.Kal.Jan.’
When 27 then ‘a.d.VI.Kal.Jan.’
When 28 then ‘a.d.V.Kal.Jan.’
When 29 then ‘a.d.IV.Kal.Jan.’
When 30 then ‘a.d.III.Kal.Jan.’
When 31 then ‘pridie Kal.Jan.’
end
end
return @romanday
end



Disclaimer:
We hope that the information on these script pages is
valuable to you. Your use of the information contained in these pages,
however, is at your sole risk. All information on these pages is provided
“as -is”, without any warranty, whether express or implied, of its accuracy,
completeness, or fitness for a particular purpose…

Disclaimer Continued

Back to Database Journal Home

Latest Articles