Tests if a string argument can be converted to a date.
ISDATE( string )
string The string to be analyzed to determine if the string represents a valid date.
INT
If a conversion is possible, the function returns 1; otherwise, 0 is returned. If the argument is NULL, 0 is returned.
This function supports NCHAR inputs and/or outputs.
SQL/2003 Vendor extension.
The following example imports data from an external file, exports rows which contain invalid values, and copies the remaining rows to a permanent table.
CREATE GLOBAL TEMPORARY TABLE MyData( person VARCHAR(100), birth_date VARCHAR(30), height_in_cms VARCHAR(10) ) ON COMMIT PRESERVE ROWS; LOAD TABLE MyData FROM 'exported.dat'; UNLOAD SELECT * FROM MyData WHERE ISDATE( birth_date ) = 0 OR ISNUMERIC( height_in_cms ) = 0 TO 'badrows.dat'; INSERT INTO PermData SELECT person, birth_date, height_in_cms FROM MyData WHERE ISDATE( birth_date ) = 1 AND ISNUMERIC( height_in_cms ) = 1; COMMIT; DROP TABLE MyData; |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |