Friday, July 26, 2013

Have you ever wished DATE() worked like this?

CREATE FUNCTION DBA."DATE" ( @y SMALLINT, @m SMALLINT, @d SMALLINT ) RETURNS DATE
BEGIN
   RETURN DATE ( STRING ( @y, '-', @m, '-', @d ) );
END;

SELECT DBA."DATE" ( 1991, 2, 3 );

DBA."DATE"(1991,2,3) 
-------------------- 
1991-02-03           

...oh, wait, now it does :)



No comments: