Apr 17, 2009 #1 skurkal IS-IT--Management Joined Apr 6, 2005 Messages 37 Location US Hi All, I have a table with 2 integer colums HourPart TimePart 13 15 14 30 I need to combine these into a time colum as follows Time 13:15 14:30 Thanks for your help in advance, sk
Hi All, I have a table with 2 integer colums HourPart TimePart 13 15 14 30 I need to combine these into a time colum as follows Time 13:15 14:30 Thanks for your help in advance, sk
Apr 17, 2009 #2 RiverGuy Programmer Joined Jul 18, 2002 Messages 5,011 Location US Code: SELECT RIGHT('0' + CONVERT(CHAR(2), HourPart), 2) + ':' + RIGHT('0' + CONVERT(CHAR(2), TimePart), 2) Upvote 0 Downvote
Code: SELECT RIGHT('0' + CONVERT(CHAR(2), HourPart), 2) + ':' + RIGHT('0' + CONVERT(CHAR(2), TimePart), 2)
Apr 17, 2009 #3 S SkipVought Programmer Joined Dec 4, 2001 Messages 47,492 Location US Hi, Code: Select TimeSerial([HourPart],[TimePart],0)... Skip, Don't let the Diatribe... talk you to death! Just traded in my old subtlety... for a NUANCE! Upvote 0 Downvote
Hi, Code: Select TimeSerial([HourPart],[TimePart],0)... Skip, Don't let the Diatribe... talk you to death! Just traded in my old subtlety... for a NUANCE!
Apr 17, 2009 #4 RiverGuy Programmer Joined Jul 18, 2002 Messages 5,011 Location US Is TimeSerial a T-SQL function? Upvote 0 Downvote
Apr 17, 2009 #5 S SkipVought Programmer Joined Dec 4, 2001 Messages 47,492 Location US I thought I was in a different forum Skip, Don't let the Diatribe... talk you to death! Just traded in my old subtlety... for a NUANCE! Upvote 0 Downvote
I thought I was in a different forum Skip, Don't let the Diatribe... talk you to death! Just traded in my old subtlety... for a NUANCE!
Apr 19, 2009 #6 CGLuttrell ISP Joined Apr 18, 2009 Messages 1 Location US The above code will leave spaces for single digit input. Try this: Code: SELECT RIGHT('0' + CONVERT(VARCHAR, 2), HourPart) + ':' + RIGHT('0' + CONVERT(VARCHAR, TimePart), 2) as Time Upvote 0 Downvote
The above code will leave spaces for single digit input. Try this: Code: SELECT RIGHT('0' + CONVERT(VARCHAR, 2), HourPart) + ':' + RIGHT('0' + CONVERT(VARCHAR, TimePart), 2) as Time