Going from 15 Minute intervals to 1 min intervals

  • I have two fields ID and Log data and log data is a 96 character long string of numbers representing 15 minute intervals from midnight to midnight.

    I need to convert these 96 characters to a full 1440 characters which would mean taking each of the 96 characters one by one and making 1 character into 15

    I had Vb macro to do the conversion but now it's broken and I can't fix it. Getting it done in SQL would solve a lot of problems.

    I then go from the 1440 fields and do log analysis like total time doing a specific activity but my query is dependant on having all 1440 characters.

    TIA!!!

    Em

  • I am certain that this can be done but we don't have enough to go by here. Can you post an example of what log data looks like and how you want it to look?

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • Okay input is like the attachment

    ID Date Log

    (input log field looks like this: 111111111111111111111111111111111111111111111333113333331113333333311111111131111111111111111111)

    it is a text field if it's 96 characters long it's Q15 minutes and if it's 1440 it's Q1

    I have the following statement so far

    ID, DATE,

    Case When Length(log) = 1440 Then Log

    When Length(log) = 96 then XXXX insert conversion code here XXXXX

    Else Null

    End as Log

    All out put would be

    ID DATE LOG -- where log is now a 1440 character Text field

    And Log now equals

    111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111333333333333333333333333333333333333333333333111111111111111111111111111111333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111333333333333333111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

    So basically every character from the log input was duplicated for the other 14 minutes to make it Q1 instead of Q15.

    Does this makes sense?

    Thanks,

    Emilie

  • Looks like you're looking for REPLICATE.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply