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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Convert to navchar

Author  Topic 

richardlaw
Yak Posting Veteran

68 Posts

Posted - 2009-01-17 : 05:40:21
Hi

I need to change the following into a navChar value - can someone please show me how?

DATEDIFF(minute, dbo.tblClasses.timeFrom, dbo.tblClasses.timeTo)

Thanks
Richard

Richard Law

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2009-01-17 : 06:07:43
use this
select 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))
Go to Top of Page

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.
Go to Top of Page

richardlaw
Yak Posting Veteran

68 Posts

Posted - 2009-01-17 : 06:54:16
Thanks both - much appreciated.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-01-17 : 07:45:17
welcome
Go to Top of Page
   

- Advertisement -