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 |
|
richardlaw
Yak Posting Veteran
68 Posts |
Posted - 2009-01-11 : 05:15:02
|
| HiI'm using the following code to extract just the time, but how can I remove the seconds???SELECT CONVERT(varchar(10), DOB, 108) AS Expr1FROM dbo.tblGymnastsMany thanksRichardRichard Law |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-11 : 05:22:25
|
| try thissolution 1:SELECT LEFT(CONVERT(varchar(10), dob, 108),5) AS Expr1FROM dbo.tblGymnasts solution 2:SELECT CONVERT(varchar(5), dob, 108) AS Expr1FROM dbo.tblGymnasts |
 |
|
|
richardlaw
Yak Posting Veteran
68 Posts |
Posted - 2009-01-11 : 05:44:19
|
| Perfect - Solution 1 works great - thank you! |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2009-01-11 : 05:45:36
|
quote: Originally posted by richardlaw Perfect - Solution 1 works great - thank you!
welcome....Solution 2 also works for u..try it. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-11 : 07:00:59
|
quote: Originally posted by richardlaw HiI'm using the following code to extract just the time, but how can I remove the seconds???SELECT CONVERT(varchar(10), DOB, 108) AS Expr1FROM dbo.tblGymnastsMany thanksRichardRichard Law
where are you using this value? is it for display or for calculation? |
 |
|
|
cwtriguns2002
Constraint Violating Yak Guru
272 Posts |
Posted - 2009-01-11 : 19:24:11
|
| i think for display only :)RON________________________________________________________________________________________________"I won't last a day without SQL" |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-11 : 23:03:05
|
| try this richardlaw,select right(convert(varchar(32),dob),7)FROM dbo.tblGymnastsselect substring(convert(varchar(32),dob),12,5)FROM dbo.tblGymnasts |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-12 : 02:16:06
|
quote: Originally posted by cwtriguns2002 i think for display only :)RON________________________________________________________________________________________________"I won't last a day without SQL"
then consider doing this at your front end. |
 |
|
|
|
|
|
|
|