|
isdate()
Using the
date and time function
isdate(), one can determine if an expression specified in the
parameter of the function is a valid
datetime
value.
The return value can either be "1", if the expression is
a valid datetime value or "0",
if the expression is not a valid datetime, or
if the value of the parameter is
NULL.
When executing the function isdate(), the current setting of
the configuration option
set dateformat
is taken into account, i.e. a date value of "2007-06-19"
is considered as a valid datetime value, if the current setting of
set dateformat is "dmy", for example,
i.e. day, month, year.
The function isdate() is available in
ASE
starting with version 15.0.1.
Syntax of the Date and Time Function isdate()
The Parameter of the Date and Time Function isdate()
"expression"
The parameter "expression" can consist of a
variable,
constant
or a
column
name.
Example for the Date and Time Function isdate()
select isdate('Hello')
go
-----------
0
The return value of the function isdate is "0", i.e.
the specified expression ("Hallo") is not a valid
datetime value.
select name,isdate(pwdate) from master..syslogins where suid = 1
go
name
------------------------------ -----------
sa 1
The return value is "1", i.e. the value in the column
pwdate for the sa user is a valid datetime value.
See also:
ASE T-SQL - Aggregate Functions, Date and Time Functions, dateadd(), datediff(), datename(), datepart(), date_part, day(), getdate(), month(), style numbers, year().
|