November 13, 2017 at 6:29 pm
Sounds like you need this article: Crosstabs and Pivots by Jeff Moden...
November 13, 2017 at 11:13 pm
I had a look at the link provided and got a clue.
DECLARE @SlowLimit INT, @MediumLimit INT, @ExpressLimit INT, @DevLimit INT
SELECT
@SlowLimit = SUM(CASE WHEN processthreadtype = 'SLOW' THEN ProcessLimit ELSE 0 END)
,@ExpressLimit = SUM(CASE WHEN processthreadtype = 'EXPRESS' THEN ProcessLimit ELSE 0 END)
,@DevLimit = SUM(CASE WHEN processthreadtype = 'DEV' THEN ProcessLimit ELSE 0 END)
,@MediumLimit = SUM(CASE WHEN processthreadtype = 'MEDIUM' THEN ProcessLimit ELSE 0 END)
FROM ProcessThreadTypeLimits
SELECT @SlowLimit AS '@SlowLimit' , @MediumLimit AS '@MediumLimit ', @ExpressLimit AS '@ExpressLimit ', @DevLimit AS '@DevLimit';
Or as a row.
SELECT
SUM(CASE WHEN processthreadtype = 'SLOW' THEN ProcessLimit ELSE 0 END) as 'SLOW'
,SUM(CASE WHEN processthreadtype = 'EXPRESS' THEN ProcessLimit ELSE 0 END) as 'EXPRESS'
,SUM(CASE WHEN processthreadtype = 'DEV' THEN ProcessLimit ELSE 0 END) as 'DEV'
,SUM(CASE WHEN processthreadtype = 'MEDIUM' THEN ProcessLimit ELSE 0 END) as 'MEDIUM'
FROM ProcessThreadTypeLimits
November 14, 2017 at 9:01 am
Maybe this:SELECT
MAX(CASE WHEN processthreadtype = 'SLOW' THEN ProcessLimit ELSE NULL END) AS [@Slow]
,MAX(CASE WHEN processthreadtype = 'EXPRESS' THEN ProcessLimit ELSE NULL END) AS [@Express]
,MAX(CASE WHEN processthreadtype = 'DEV' THEN ProcessLimit ELSE NULL END) AS [@Dev]
,MAX(CASE WHEN processthreadtype = 'MEDIUM' THEN ProcessLimit ELSE NULL END) AS [@Medium]
FROM ProcessThreadTypeLimits;
Steve (aka sgmunson) 🙂 🙂 🙂
Rent Servers for Income (picks and shovels strategy)
Viewing 3 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply