<p>In a SQL-database I make some selects, that get an duration (as result of a subtraction between two dates) in seconds as an int. But I want to format this result in a human-readable form like 'hh:mm' or 'dd:hh'. Is that possible in SQL and how can I realize this?</p>

In SQL 2005, You can use the following:
```
```
select convert(varchar(8), dateadd(second, [SecondsColumn], 0),  108)
```
```
Which first converts the seconds into a date after 1900-01-01, and then gets the hh:mm:ss part.
If the column is more than 24 hours, this will roll over, if you want days and then hours in that case just do something like:
```
```
case when SecondsColumn> (24*60*60) 
        then 
            cast(datepart(day,datediff(dd, 0, dateadd(second, SecondsColumn, 0))) as varchar(4))
        +   'd' + convert(varchar(2), dateadd(second, SecondsColumn, 0), 108) 
    else
            convert(varchar(8), dateadd(second, SecondsColumn, 0), 108) 
    end
```
```