Forum Replies Created

Viewing 15 posts - 31 through 45 (of 47 total)

  • RE: DatePart Function

    For the pivot, I posted something like what you are trying to do a little while ago..

    http://qa.sqlservercentral.com/Forums/Topic475805-338-1.aspx#bm476235

    It shouldn't be too hard to switch it around for a quarterly summary too.

  • RE: Stored Procedure - which is faster/better?

    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...

  • RE: Largest Unit

    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...

  • RE: Query

    ... And what about the Not in List option? I didn't see DATEPART(month,join_date) in (1,2,3,4,5,8) in the list, so that should be a valid option too

  • RE: OR statement issue

    Thats what i'd say too, keep it simple and do a union with the two sets of logic.

  • RE: Selecting data in a grid?

    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])

    ...

  • RE: Selecting data in a grid?

    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!

  • RE: Most scalable way to track responses

    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...

  • RE: Best Way to Calculate Age

    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...

  • RE: select statement with order by

    Thanks for pointing out the difference in sql versions!

  • RE: Across Server Query

    Thanks for posting the solution you found. I figured it would be something like that, but now we all know!

  • RE: select statement with order by

    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

  • RE: a select SQL uses join,subquery,and group by,PROBLEM

    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.

  • RE: Setting variables with 'if exists'

    np, glad to help

  • RE: Setting variables with 'if exists'

    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...

Viewing 15 posts - 31 through 45 (of 47 total)