Viewing 15 posts - 301 through 315 (of 1,182 total)
I'll go ahead and add my 2 cents here too. SSRS is much more intuitive. This is only my personal opinion, but I go running and screaming out of the...
May 11, 2011 at 12:28 pm
On a serious and slightly related note. Years ago, I believe sometime around 2005, Steve and Red Gate gave out free copies of SQL Prompt for the "top posters" in...
April 29, 2011 at 7:01 am
No need to CAST.
SELECT
NAME, LASTNAME,
CASE WHEN AGE > 25 THEN '1' ELSE '' END AS QUALIFIED
FROM
TABLE1
April 28, 2011 at 6:13 pm
Then use your method of
LEFT(rowid,charindex('.',rowid)-1)
April 28, 2011 at 3:14 pm
use a subquery ....
select
floor(rowID) as trunk
,max(Availability)
from (select
rowid,
sum(case when [status] like '%in-service%' then 1 else 0 end)
/ (count(*)*1.) as Availability -- the *1. is to force conversion to numeric
from...
April 28, 2011 at 2:44 pm
as long as we force one of the two values to numeric. without my parentheses, it was forcing the convert AFTER the division. :hehe:
April 28, 2011 at 2:25 pm
Sorry, I missed the parentheses around the *1.
select
rowid,
sum(case when [status] like '%in-service%' then 1 else 0 end)
--/ (count(*)*1.) as Availability -- the *1. is to force conversion to...
April 28, 2011 at 2:21 pm
PHXHoward (4/28/2011)
I have a long list of devices and need to know the availability for each of them.
how are they to be grouped? by device type, device name, etc ....
Post...
April 28, 2011 at 2:00 pm
If rowID is what it seems to be, unique for each row, then you'll need to remove rowID completely from the SELECT and GROUP BY
April 28, 2011 at 1:58 pm
For clarification: Don't think of this as a count from two queries. You are querying one table, one time and performing an aggregate depending on the values in that table....
April 28, 2011 at 1:53 pm
select
rowid,
sum(case when [status] like '%in-service%' then 1 else 0 end)
/ count(*)*1. as Availability -- the *1. is to force conversion to numeric
from CustomPollerStatistics_Detail
group by rowid
April 28, 2011 at 1:49 pm
Funny, this is almost identical to this question. Is this homework?
At any rate, your answer can be found here.
http://www.sqlservercentral.com/Forums/Topic1094079-392-1.aspx#bm1094158
April 28, 2011 at 6:18 am
Judging from some people's anger level at question semantics, the points are worth more than a gallon of gas. :hehe:
April 27, 2011 at 8:27 am
If you wrap the trigger code in an IF statement, you can at least have the trigger "do nothing" unless the specified column is updated.
As in ...
IF UPDATE(columnName)
BEGIN
...
April 27, 2011 at 7:49 am
Viewing 15 posts - 301 through 315 (of 1,182 total)