Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Makkaramestari
Starting Member
8 Posts |
Posted - 2005-12-28 : 06:50:29
|
Hello!I have two fields, Field1 and Field2, both int.If Field1 contains 23 and Field2 contains 55, with CAST functionI manage to produce output looking like 23:55 (casting int to varchar). On the other hand, if Field1 contains 23 and Field2 contains 0, all I get is 23:0 How do I format it to look like 23:00?Yours, Makkaramestari |
|
|
sqlmember
Starting Member
7 Posts |
Posted - 2005-12-28 : 07:14:52
|
try thisdeclare @a int, @b intset @a = 23set @b = 0select right('00'+cast(@a as varchar(2)),2) + ':' + right('00'+cast(@b as varchar(2)),2) -Khurram Iqbal |
 |
|
|
Makkaramestari
Starting Member
8 Posts |
Posted - 2005-12-28 : 07:25:36
|
| Hi!Thank you very much!Makkaramestari |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-28 : 07:47:03
|
| Where do you want to show these data?If you use Front End Application use this type of formations thereMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|