3

I'm writing a view to get hours of holiday count from the minutes.

Minutes data type is INT in the data table

I wrote this but it doesn't work:

DATEPART(HOUR, CONVERT(DATETIME, '00:' + CAST(S.availablevacations AS NVARCHAR(5)) + ':00:000', 114))

COMPILER ERROR: Create View failed because no column name was specified for column 6.

1

1 Answer 1

3

you can try this

SELECT CONVERT(NUMERIC(18, 2), `TotalMinutes`/ 60 + (`TotalMinutes`% 60) / 100.0)

this will convert you minutes to HH.MM format sql format

Sign up to request clarification or add additional context in comments.

1 Comment

Different and clever approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.