Expand|Select|Wrap|Line Numbers
- CREATE FUNCTION DATE2SQL (DATEI DATE)
- RETURNS DATE
- LANGUAGE SQL
- BEGIN atomic
- DECLARE RESULT DATE;
- IF CAST(DATEI AS VARCHAR(10)) < '1753-01-01'
- THEN SET RESULT = '1753-01-01' ;
- ELSE SET RESULT = DATEI;
- END IF;
- RETURN RESULT;
- END@
Why it does it: Because I'm importing the db2 database into MS SQL server, where dates pre-1753 are not accepted.
What's the problem: The problem is I have been told this UDF, while it works on the windows test box, will not function when it's rolled out to the mainframe, because of the IF statement.
What can I do to replace the IF statement so that the UDF functions on the mainframe, and will still do what I need it to do.
Any help would be greatly appreciated!
chigasakigaijin