Re: conversion
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 08/30/04
- Next message: Ibrahim Shameeque: "RE: A generic SP for determining if null image field"
- Previous message: TomislaW: "Re: output in one row?"
- In reply to: simon: "conversion"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 30 Aug 2004 09:59:24 +0200
On Mon, 30 Aug 2004 09:37:12 +0200, simon wrote:
>I have table time where I have column for second,minute and hour.
>
>For example:
>
>hour minute second
>------------------------------
> 9 5 3
>
>If I execute: SELECT cast(hour as varchar(2))+':'+cast(minute as
>varchar(2))+':'+cast(second as varchar(2)) as time FROM time, I'll get:
>
>9:5:3, but what I would like to get is: 09:05:03
>
>Is there some simple conversion or I have to use string function len and
>select case statements?
>
>thank you,
>Simon
>
Hi Simon,
You can use RIGHT('00' + CAST(hour AS varchar(2)), 2)
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: Ibrahim Shameeque: "RE: A generic SP for determining if null image field"
- Previous message: TomislaW: "Re: output in one row?"
- In reply to: simon: "conversion"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|