Home Forums SQL Server 2008 T-SQL (SS2K8) varchar to time or datetime or ARGGHH Please help me. RE: varchar to time or datetime or ARGGHH Please help me.

  • How are you trying to calculate difference?

    Is the Appt Time should be taken as for the same date as one in the column which contains date and time?

    What is really your wait time?

    Is this any help to you:

    DECLARE @dt DATETIME, @appttime CHAR(4)

    SELECT @dt = GETDATE(), @appttime = '0730'

    SELECT @dt

    ,@appttime

    ,DATEADD(MINUTE, CAST(RIGHT(@appttime,2) AS INT)

    ,DATEADD(HOUR, CAST(LEFT(@appttime,2) AS INT), @dt))

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]