Forum Replies Created

Viewing 9 posts - 16 through 24 (of 24 total)

  • RE: Narrow down the recordset

    alorenzini (2/12/2008)


    I haven't change anything in the Repromote proc, this is code as it now:

    ALTER PROCEDURE [consultantreports].[uspS_DownlineRepromotions2]

    @CONSULTANTID VARCHAR(MAX)

    AS

    SET NOCOUNT ON

    DECLARE @x XML

    SET @x = ' '

    Where do you assign the...

  • RE: Narrow down the recordset

    Have you changed uspS_DownlineRepromotions2 in some way?

    Try to run the uspS_DownlineRepromotions2 procedure separately in a query window with the same ConIds....

  • RE: Narrow down the recordset

    Yes it is but if you change...

    INSERT INTO #Temp(ConsultantID, AchieveLevel, AchieveTitle, PeriodEndDate, RepFlag)

    EXEC uspS_DownlineRepromotions2 @ConIDs

    It should work

  • RE: Narrow down the recordset

    Is it possible that the parameter length in uspS_DownlineRepromotions2 is shorter?

    In another post it was varchar(8000)

  • RE: Narrow down the recordset

    Declaring a table variable (@C) may lead to performance problems because all rows you insert will be stored in memory...

    You may try with a temp table instead.

    CREATE TABLE #C(

    ConsultantID CHAR(7),

    Level...

  • RE: Narrow down the recordset

    Adam's solution seems more tested than mine...I'm sure it is 🙂 otherwise I think this will work...but be aware, it's not tested

    Select c1.ConsultantID, c1.Level, c1.Title, c1.PeriodEndDate

    from @C...

  • RE: Narrow down the recordset

    You're correct...I didn't understand the issue...but...do I understand the issue now?

    If you copy your own code in an earlier post...

    Declare @C Table....

    Some inserts....

    Down to...Declare @r table...

  • RE: Narrow down the recordset

    Every column in the select list has to be in the Group By Clause except columns involved in aggregates. Ex:

    Select A, B, C, SUM(D) as Dsum

    from Table

    Group By A, B,...

  • RE: Narrow down the recordset

    I would have used Group By and Having Clauses

    Select Title, Max(PeriodEndDate) as PeriodEndDate

    from YourTableName

    group by ConsultantId, Level, Title

    having Count(PeriodEndDate) > 1

Viewing 9 posts - 16 through 24 (of 24 total)