Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2004
    Posts
    91

    Unanswered: Query conversion help please...

    Hi everyone,

    I have a working MS SQL statement...


    truncate table tblifbatchtimes
    go

    BEGIN
    DECLARE @st as datetime
    select @st = '1/1/2005 00:00:01 AM'
    insert into tblifbatchtimes
    (
    IFBAT_dtBatchTime, IFBAT_lChangeCTR, IFBAT_boolSelectedFlag
    )
    values
    (
    @st,
    0,
    0
    )
    select @st = '1/1/2005 00:05:00 AM'
    while (@st < '1/2/2005')
    BEGIN
    insert into tblifbatchtimes
    (
    IFBAT_dtBatchTime, IFBAT_lChangeCTR, IFBAT_boolSelectedFlag
    )
    values
    (
    @st,
    0,
    0
    )
    select @st = dateadd(minute, 5, @st)
    END
    END
    go

    delete from tblifbatchtimes where ifbat_dtBatchtime = '1/2/2005'
    go



    When i try to execute this statement under sybase ASA 7
    it fails...

    stating the problem is with the delcare....

    what am i doing wrong???

    thanks
    tony

  2. #2
    Join Date
    Dec 2004
    Posts
    25
    try ===> DECLARE @st datetime

  3. #3
    Join Date
    Oct 2004
    Posts
    91

    yupper

    Great catch!!

    A little date format change, and it worked great!


    Here is the updated query....

    <code>
    BEGIN
    DECLARE @st datetime
    select @st = '2005-01-01 00:00:00 AM'
    while (@st < '2005-01-02')
    BEGIN
    insert into tblifbatchtimes
    (
    IFBAT_dtBatchTime, IFBAT_lChangeCTR, IFBAT_boolSelectedFlag
    )
    values
    (
    @st,
    0,
    0
    )
    select @st = dateadd(minute, 5, @st)
    END
    END
    go

    </code>


    thanks again for your help!!!

    take care
    tony

Posting Permissions

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