Results 1 to 3 of 3

Thread: VB to SQL

  1. #1

    Thread Starter
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621

    VB to SQL

    Hi All

    I need to be able to chenge this
    VB Code:
    1. If TimeValue(Time) <= TimeValue(TimeSerial(mvarSessionStartTime, 0, 0)) Then
    2.         SessionDate = DateAdd("d", -1, Date)
    3.     Else
    4.         SessionDate = Date
    5.     End If

    to a SQL equivilant in a stored procedure


    Does anyone have any ideas. SQL doesn't seem to have the vb equivilant functions.

    Thanks
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


  2. #2
    Lively Member
    Join Date
    Jul 2002
    Location
    California
    Posts
    77
    Perhaps I'm missing something here, but would this work

    IF GETDATE() <= @DateValue

    @NewDate = DATEADD(d, -1, GETDATE())

    ELSE

    @NewDate = GETDATE()

    END IF

    Where @DateValue is a passed value and @NewDate is a variable declared in the stored procedure.

    I think the following is possible, but I can't make it work unless converting the date to an integer)...

    Instaed of @NewDate, you could just have the stored procedure return the value...

    return DATEADD(d, -1, GETDATE())


    I don't know how to post code as you did. How do you do that?

  3. #3

    Thread Starter
    Fanatic Member Gary.Lowe's Avatar
    Join Date
    May 2000
    Location
    In my sphere of influence
    Posts
    621
    Thanks Virgil
    Gary Lowe
    VB6 (Enterprise) SP5
    ADO 2.6
    SQL Server 7 SP3

    OK I know my spelling and grammer is crap so don't quote me on it!

    To err is human to take the P! is only natural !!

    Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip


Posting Permissions

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



Click Here to Expand Forum to Full Width