Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2012

    Unanswered: Converting tinyint data type to Date for loading to sybase

    Hi All,

    I am working on laoding data to Sybase db i have three column in source table which are Tinyint(Year,Month,Day) i need to concatenate them and load it in Date(ISO:'YYYYMMDD') Format.
    year(tinyint) Month(tinyint) Day(tinyint)
    2000 01 22


    i am trying with following queries which did'nt worked
    Note:IN Sybase we can not convert tinyint to date directly.

    select CONVERT(DATE,(CAST((year*10000+month*100+day) AS VARCHAR)),112) from Table_name;

    select CAST((year*10000+month*100+day) AS DATE) from Table_name;

    select CAST((CONVERT(CHAR,(year*10000+month*100+day))) AS DATE) from Table_name;

    getting following error:

    om.sybase.jdbc3.jdbc.SybSQLException: SQL Anywhere Error -1001006: Data exception - data type conversion is not possible.
    -- (dfe_Cast.cxx 795)

    Any buddy has any idea about it.

    Thanks & Regards

  2. #2
    Join Date
    May 2005
    South Africa
    Provided Answers: 1
    ?? I don't know SQL Anywhere but tinyint is normally 1 byte long and can only hold a max value of 127. Not sure how you fit the year 2000 in it.
    I suggest you check your data.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts