Wednesday, April 16, 2014

SSRS: Detecting NULL dates and showing empty string


=IIF(Fields!f.Value= nothing, " ", Format(CDate(Fields!f.Value),"MMM dd, yyyy hh : mm tt"))
Thanks
Mahesh

Wednesday, April 9, 2014

How to split minutes into days, hours and minutes in tsql


Declare @theMinutes int
Set @theMinutes = 2147483647

Select convert(varchar(15), @theMinutes / 1440 ) +' Days'
       + ' ' + REPLICATE('0', 2 - DATALENGTH(convert(varchar(2), (@theMinutes % 1440) / 60 ))) + convert(varchar(2), (@theMinutes % 1440) / 60 ) + ' Hours '
       + ' ' + REPLICATE('0', 2 - DATALENGTH(convert(varchar(2), (@theMinutes % 60)))) + convert(varchar(2), (@theMinutes % 60)) + ' Minutes 'as Days_Hours_Minutes