Showing posts with label direction. Show all posts
Showing posts with label direction. Show all posts

Friday, March 30, 2012

how to change the data label in SQL?

I have the following SQL statement..

select month(dbo.udfAddUTCBias(start_date_time, 180)) as report_month, direction as direction, count(*) as total_records from traffic with (nolock) where dbo.udfAddUTCBias(start_date_time, 180) >= '2/24/2007' and dbo.udfAddUTCBias(start_date_time, 180) < DateAdd(dd, 1, '2/24/2007') group by month(dbo.udfAddUTCBias(start_date_time, 180)), direction

but the result of the direction field is 1 and 0..

however, I need to show inbound when the result is 0 and outbound when the result is 1 without changing the actual data in the table.

You could use CASE keyword: http://msdn2.microsoft.com/en-us/library/aa258235(SQL.80).aspx

select month(dbo.udfAddUTCBias(start_date_time, 180)) as report_month

, case direction

when 0 then 'inbound'

when 1 then 'outbound'

end

as direction

, count(*) as total_records from traffic with (nolock) where dbo.udfAddUTCBias(start_date_time, 180) >= '2/24/2007' and dbo.udfAddUTCBias(start_date_time, 180) < DateAdd(dd, 1, '2/24/2007') group by month(dbo.udfAddUTCBias(start_date_time, 180)), direction

Wednesday, March 7, 2012

How to calculate table and index size

Can anyone point me in the right direction on how to calculate table and
index sizes
TIA
RobEXEC sp_spaceused 'tablename'
http://www.aspfaq.com/
(Reverse address to reply.)
"Rob Diamant" <rob@.usi.com> wrote in message
news:#4qxCfGsEHA.808@.TK2MSFTNGP12.phx.gbl...
> Can anyone point me in the right direction on how to calculate table and
> index sizes
> TIA
> Rob
>

How to calculate table and index size

Can anyone point me in the right direction on how to calculate table and
index sizes
TIA
RobEXEC sp_spaceused 'tablename'
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Rob Diamant" <rob@.usi.com> wrote in message
news:#4qxCfGsEHA.808@.TK2MSFTNGP12.phx.gbl...
> Can anyone point me in the right direction on how to calculate table and
> index sizes
> TIA
> Rob
>

How to calculate table and index size

Can anyone point me in the right direction on how to calculate table and
index sizes
TIA
Rob
EXEC sp_spaceused 'tablename'
http://www.aspfaq.com/
(Reverse address to reply.)
"Rob Diamant" <rob@.usi.com> wrote in message
news:#4qxCfGsEHA.808@.TK2MSFTNGP12.phx.gbl...
> Can anyone point me in the right direction on how to calculate table and
> index sizes
> TIA
> Rob
>