Welcome to Sign in | Help
in Search

mysql - cum se verifica un varchar ca este de tip data ?

Last post 05-13-2008, 4:40 PM by ignatandrei. 2 replies.
Sort Posts: Previous Next
  •  05-13-2008, 3:49 PM 4876

    mysql - cum se verifica un varchar ca este de tip data ?

    Am citeva varchar intr-o coloana de tip varchar.
    Are mySQL functia "isdate" ?
    ca, daca am dat date_format(coloana, '%Y %m %D'),day(coloana)
    mi-a intors bucuros
    2007-12-00 , 0


    Ignat Andrei
    http://serviciipeweb.ro/iafblog
  •  05-13-2008, 3:59 PM 4878 in reply to 4876

    Re: mysql - cum se verifica un varchar ca este de tip data ?

    Aici găseşti
    CREATE FUNCTION IsDate (sIn varchar(1024)) RETURNS INT
    BEGIN
    declare tp int;

    if length(date(sIn)) is not null then
    set tp = 0;
    else
    set tp = 1;
    end if;
    RETURN tp;
    END

  •  05-13-2008, 4:40 PM 4882 in reply to 4878

    Re: mysql - cum se verifica un varchar ca este de tip data ?

    begin
    declare tp int

    if length(date('2007-01-01')) is not null then
    set tp = 0
    else
    set tp = 1
    end if

    end

    da eroarea:
    [...] ERROR 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'declare tp int

    if length(date('2007-01-01')) is not null then
    set tp = 0
    else
    s' at line 2

    Help


    Ignat Andrei
    http://serviciipeweb.ro/iafblog
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems