Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Posts
    21

    Unanswered: Urgent - Cannot insert into a table!!

    Hi

    It's easy for experts of Sybase!

    I have this query. But I'm not safe with Sybase... please help me.

    INSERT INTO AI_Budget_Main values (6, '', '3/8/2005 12:00:00 AM', '1/1/0001 12:00:00 AM', '', '', '', '3/22/2005 12:00:00 AM', '', '', 'Aberto', 'EmProcesso', '', '', '', '', ''); commit;

    The type of this column is timestamp. But it cannot insert 'cause of the format of the date "3/8/2005". It accepts when I put this "3-8-2005" (runs well). Why this ran when I put 3-8-2005, and not when I put 3/8/2005 ??

    Becase this I have to modify this query.

    So, I have to get a way when I put "3/8/2005", it automatically convert to a format wich can be inserted into a field (3-8-2005).

    Please!! Does anyone can save me??
    Really thanks.
    Juliane

  2. #2
    Join Date
    Feb 2005
    Location
    Omaha, NE
    Posts
    83
    Looks like a typo in your syntax to me. The second value in your comma separated list is:

    '', '3/8/2005 12:00:00 AM', '1/1/0001 12:00:00 AM', ''

    Which is a text string that doesn't convert to a date.

  3. #3
    Join Date
    Aug 2003
    Posts
    43
    I created a sample table for datetime column type and executed following statements.

    From below it looks like it is very unlikely that the error is due to the date format '3/8/2005'.
    As suggested by Sherlock it could be the problem with some other column.

    1> create table date_test (date1 datetime)
    2>
    1> insert date_test values('3/8/2005 12:00:00 AM')
    2>
    (1 row affected)
    1> insert date_test values('3/8/2004')
    2>
    (1 row affected)
    1> select * from date_test
    2>
    date1
    --------------------------
    Mar 8 2005 12:00AM
    Mar 8 2004 12:00AM

    (2 rows affected)
    1>

Posting Permissions

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