Viewing 15 posts - 31 through 45 (of 47 total)
For the pivot, I posted something like what you are trying to do a little while ago..
http://www.sqlservercentral.com/Forums/Topic475805-338-1.aspx#bm476235
It shouldn't be too hard to switch it around for a quarterly summary too.
April 30, 2008 at 12:10 pm
I've always stayed away from dynamic sql inside a stored procedure as I thought that SQL server wasn't able to cache the execution plan, so the static strucutre would be...
April 30, 2008 at 12:02 pm
I agree with Wikipedia on this one too. If the question was more precise, using the decimal abbreviation, then I'd have only checked the decimal answers. Unfortunately I...
April 9, 2008 at 9:05 pm
Thats what i'd say too, keep it simple and do a union with the two sets of logic.
March 28, 2008 at 9:52 am
Here's what I came up with....
SELECT [Pentile],
ISNULL([1],0)'Jan',
ISNULL([2],0)'Feb',
ISNULL([3],0)'Mar',
ISNULL([4],0)'Apr',
ISNULL([5],0)'May',
ISNULL([6],0)'Jun',
ISNULL([7],0)'Jul',
ISNULL([8],0)'Aug',
ISNULL([9],0)'Sep',
ISNULL([10],0)'Oct',
ISNULL([11],0)'Nov',
ISNULL([12],0)'Dec'
FROM (SELECT [MonthNr], [Pentile], [DetailAmt] FROM CyclePentileDetail_tb
WHERE DetailType = @SegmentID AND SegmentID = @DetailType) A
PIVOT (SUM([DetailAmt])
...
March 28, 2008 at 9:47 am
Thanks, thats the operator that I couldn't recall. I was trying Cube, which wasn't getting me there, but I knew there was a way!
March 28, 2008 at 7:56 am
Thanks for the feedback. I've thought about it a bit more too, and will probably go with a child table for the quick insert (to the user), then if...
March 10, 2008 at 3:06 pm
I want my point! datatype or not, I can't pick the choice that doesn't return my correct age! 2 was the only one that worked for me, so...
March 7, 2008 at 10:07 pm
Thanks for pointing out the difference in sql versions!
February 17, 2008 at 2:38 pm
Thanks for posting the solution you found. I figured it would be something like that, but now we all know!
February 10, 2008 at 3:39 pm
For whatever reason you need to display the same column twice, you should alias the column so try:
select distinct firstname as fname, firstname from customers
order by firstname
February 10, 2008 at 3:27 pm
You have to include all columns you are including in the summary result, unless you are doing some kind of an aggregate on the column... thus the error message.
February 10, 2008 at 3:18 pm
Why not try to dosomething like ...
select @UserNamePro = pro.Alias, @EntityID = pro.ProviderEntityID
from
Migration.dbo.util_DH_Providers pro
where pro.ProviderEntityID = @PersonID
if @UserNamePro is Null
set @EntityType = 'Professional'
else
set...
January 15, 2008 at 4:39 pm
Viewing 15 posts - 31 through 45 (of 47 total)