Claus on Code

A data dudes random musings about code, bugs, products, life etc.


  • SQL TIP-> Display seconds as HH:MM:SS

    In many BI application you have stored a duration as seconds. To display that on the format HH:MM:SS just use the following SQL(Replace 100 with your column name): Wich yield the result As in my previous blogpost where I did the same in analysis services, this only works if the duration is below 24 hours,… Continue reading

  • Fun with SQL: Joining on column name and row field value

    Ok, it is that time of the day where I’m starting to get high on caffeine 🙂 So this is the scenario. I have an application that is automatically generating a table in my database. It can add columns on the fly(But thankfully not delete). It could look like this: We can now query information… Continue reading

  • SQL Convert datetime to Salesforce date format

    If anyone, as I, suffers the pain of generating SOQL to salesforce, here’s a little tip 🙂 If you have a datetime field, which you have to use in the SOQL, then convert it like so: SELECT CONVERT(NVARCHAR,GETDATE(),126) Then you get it in the format YYYY-MM-DDTHH:MM:SS.XXX As salesforce wants it 🙂 Continue reading