I have a table with columns Hour and Minute, both containing an integer. (There are other columns as well). Now, I want to create a view from this table and I need to combine these two columns' data into one column with a ':' symbol. For example, if a record has 8 for Hour, 10 for Minute, the combined column should contain 08:10. One digit numbers need to be followed by a leading 0, which initially does not exist in Hour and Minute columns.
I was successfully able to convert the integer to varchar and concatenate the numbers with ':' with the following SQL command
/* Combined Column name "Time" */
SELECT
Cast([Hour] as varchar) + ':' + Cast([Minute] as varchar) As Time
FROM Table1
but I am not sure how I can add leading 0 to this only if the number is one digit. Can someone please help me with this? Thank you.