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-17 : 05:40:21
|
HiI need to change the following into a navChar value - can someone please show me how?DATEDIFF(minute, dbo.tblClasses.timeFrom, dbo.tblClasses.timeTo)ThanksRichardRichard Law |
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-17 : 06:07:43
|
use thisselect convert(nvarchar(32),DATEDIFF(minute, '2009-01-17 16:21:41.017', getdate()))select cast(DATEDIFF(minute, '2009-01-17 16:21:41.017', getdate())as nvarchar(32)) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-17 : 06:37:01
|
why change number of minutes to a varchar value? if this is for formatting, try doing this at front end. Its not advisable to change datatype in sql. By doing this you are making it complicated to use value in calculations. |
|
|
richardlaw
Yak Posting Veteran
68 Posts |
Posted - 2009-01-17 : 06:54:16
|
Thanks both - much appreciated. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-17 : 07:45:17
|
welcome |
|
|
|
|
|