I am currently migrating from MSDE to PostgreSQL and have to rewrite the
function that is calculating next date of sampling...
In MSDE there is a DateAdd function. I can't find the appropriate function
in postgre. Can you help me?
The function in MSDE is the following:
ALTER FUNCTION dbo.slisp
(
@UCESTALOST_BRO J int,
@UCESTALOST_JED INICA nvarchar (50),
@DATUM_ISPITIVA NJA datetime
)
RETURNS datetime
AS
BEGIN
DECLARE @SLISP datetime
IF @UCESTALOST_JED INICA='m' SET @SLISP=DATEADD( month, @UCESTALOST_BRO J,
MAX(@DATUM_ISPI TIVANJA))
IF @UCESTALOST_JED INICA='g' SET @SLISP=DATEADD( year, @UCESTALOST_BRO J,
MAX(@DATUM_ISPI TIVANJA))
IF @UCESTALOST_JED INICA='d' SET @SLISP=DATEADD( day, @UCESTALOST_BRO J,
MAX(@DATUM_ISPI TIVANJA))
RETURN @SLISP
END
Thanks.
function that is calculating next date of sampling...
In MSDE there is a DateAdd function. I can't find the appropriate function
in postgre. Can you help me?
The function in MSDE is the following:
ALTER FUNCTION dbo.slisp
(
@UCESTALOST_BRO J int,
@UCESTALOST_JED INICA nvarchar (50),
@DATUM_ISPITIVA NJA datetime
)
RETURNS datetime
AS
BEGIN
DECLARE @SLISP datetime
IF @UCESTALOST_JED INICA='m' SET @SLISP=DATEADD( month, @UCESTALOST_BRO J,
MAX(@DATUM_ISPI TIVANJA))
IF @UCESTALOST_JED INICA='g' SET @SLISP=DATEADD( year, @UCESTALOST_BRO J,
MAX(@DATUM_ISPI TIVANJA))
IF @UCESTALOST_JED INICA='d' SET @SLISP=DATEADD( day, @UCESTALOST_BRO J,
MAX(@DATUM_ISPI TIVANJA))
RETURN @SLISP
END
Thanks.