Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    3

    Question Unanswered: Link Table Problem with Syabase

    Hi ,

    I linked sybase database to access databse.
    for one table i am sending date field as >#12/12/2003 11:30 AM# AND <#12/12/2003 12:31 AM#( i am directly mentioning this in Access databse in creteria field) . so i am able to pick the 1 hr data from the table.

    but if i am sending Start datetime as 12/12/2003 11:30 AM and endtime 12/12/2003 12:31 AM for the date field sysbase is giving me ODBC failed error..

    what might be the problem??
    how can i send the date dynamically to the syabase thru MS-Access databse...????

    Thanks in advance

    Devendar

  2. #2
    Join Date
    Nov 2003
    Posts
    5
    I guess this is problem with Date format. use date functions to change to format and try to use the format that is common to Access and Sybase.

    Regards.

  3. #3
    Join Date
    Sep 2003
    Location
    Switzerland
    Posts
    443
    I feel the problem is this. When you store a date with a function like getdate() in a datetime field, even the seconds are stored.

    So, when you query without the seconds part, your query will not return the value.

    In the below examples, EXAMPLE 1 works because I didnt mention the seconds and the default second is 00

    In EXAMPLE 2, I used getdate(), so it assigns the current seconds and when I query without the seconds, it will not work.

    In EXAMPLE 3, I explicitly put the seconds and I queried with the seconds and it worked.

    Hope this helps.



    1> create table a(b int not null, c datetime)
    2> go

    EXAMPLE 1

    1> insert into a values(1,"10/11/2003 09:30")
    2> go
    (1 row affected)
    1> select * from a
    2> go
    b c
    ----------- --------------------------
    1 Oct 11 2003 9:30AM

    (1 row affected)
    1> select * from a where c='10/11/2003 09:30'
    2> go
    b c
    ----------- --------------------------
    1 Oct 11 2003 9:30AM

    (1 row affected)

    EXAMPLE 2

    1> insert into a values(2,getdate()
    2> )
    3> go
    (1 row affected)
    1> select * from a
    2> go
    b c
    ----------- --------------------------
    1 Oct 11 2003 9:30AM
    2 Jan 11 2004 10:51AM

    (2 rows affected)
    1> select * from a where c="01/11/2004 10:51"
    2> go
    b c
    ----------- --------------------------

    (0 rows affected)

    EXAMPLE 3

    1> insert into a values(3,"10/12/2003 09:30:05")
    2> go
    (1 row affected)
    1> select * from a where c="10/12/2003 09:30:05"
    2> go
    b c
    ----------- --------------------------
    3 Oct 12 2003 9:30AM

    (1 row affected)

Posting Permissions

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