Just wanted to let you know, there is no need to quote previous posts most of the time unless it is absolutely necessary.
The routine codes are as below, I didn't get much time to write the code, but they do work.
If it's a 'smalldatetime' datatype, then use this one,
Code: Select all
RoutineName = 'SQLServerSmallDateTimeRangeValidation'
If IConv(Arg1[1,10],"D-YMD[4,2,2]") >= -24835 and IConv(Arg1[1,10],"D-YMD[4,2,2]") <= 40700
Then
Ans = Arg1[1,16]
End
Else
Ans = '1900-01-01 00:00'
End
Return(Ans)
If it's a 'datetime' datatype then use this one,
Code: Select all
RoutineName = 'SQLServerDateTimeRangeValidation'
If IConv(Arg1[1,10],"D-YMD[4,2,2]") >= -78525 and IConv(Arg1[1,10],"D-YMD[4,2,2]") <= 2933598
Then
Ans = Arg1[1,16]
End
Else
Ans = '1900-01-01 00:00'
End
Return(Ans)
HTH,
Whale.