View Single Post
  (#98 (permalink)) Old
Grimlin Offline
CrackBerry Addict
 
Grimlin's Avatar
 
Posts: 516
Join Date: Jun 2005
Location: Signal Mountain, TN
Model: 9000
PIN: Positive Intrinsic Negative???
Carrier: at&t
Thumbs up Got zeros!!! - 08-25-2005, 03:16 PM

I talked with one of our folks here today about the leading zeros sorting issue in the inactive field of the view. He gave me an entirely new way to look at it. after it is converted to a string, add more zeros than you need and then do a right function to grab the part you want. I could have smacked myself for it being so simple. I have updated the view and will update the zip file tonight, but I thought I should share the discovery.

RIGHT('000' + RTRIM(CONVERT(nchar(10), DATEDIFF(hh, dbo.UserStats.LastFwdTime, GETUTCDATE()) / 24)), 3)
+ ' Days ' + RIGHT('00' + RTRIM(CONVERT(nchar(10), DATEDIFF(mi, dbo.UserStats.LastFwdTime, GETUTCDATE()) / 60 - DATEDIFF(hh,
dbo.UserStats.LastFwdTime, GETUTCDATE()) / 24 * 24)), 2) + ' Hrs' AS Inactive


__________________
Berries Carried:
9000, 8820
8800, 7270, 8700c, 7290, 7230
7510, 6510, 5810, 957, 857, 950
   
Reply With Quote