Forum Replies Created

Viewing 15 posts - 46 through 60 (of 258 total)

  • RE: TEMP Tables

    it seems like it's inserting a blank row for each of the Filtere statements that it passes through. So I end up with for empty rows instead of just one.

  • RE: TEMP Tables

    This almost works but it's ignoring the last ELSE:

    ELSE Select Distinct OrigConsID, ORigConsName

    FROM #DlFiltered WHERE ConsultantID IS NULL

  • RE: TEMP Tables

    I think I almost have this. Current code:

    IF @LineFilter = ('Only Line 1')

    BEGIN

    SELECT DIstinct * from #DLFiltered WHERE Active = 1

    AND DownlineLevel = 1

    AND EffectiveDate BETWEEN @StartPeriodDate AND...

  • RE: MAX Function is not working correctly

    Thanks a lot that worked like a champ.

  • RE: MAX Function is not working correctly

    I recieve the following message:

    Msg 144, Level 15, State 1, Line 13

    Cannot use an aggregate or a subquery in an expression used for the group by list of a GROUP...

  • RE: TEMP Tables

    Lets see if I can explain the what I am seeing ( I am now getting two records set back, one that is empty (expected) and one with all the...

  • RE: TEMP Tables

    It doing the insert regardles of a empty record set. I am a bit confused now, in my brain I would think it needs to look something like this:

    IF @LineFilter...

  • RE: TEMP Tables

    Doing it this way how does it know what filter to use?

    IF EXISTS (SELECT NULL FROM #DLFiltered

    WHERE Active = 1

    AND DownlineLevel = 1

    ...

  • RE: TEMP Tables

    What I expect to see would be that in the If Statement did not return any rows then a insert would happen into the table and then that row would...

  • RE: TEMP Tables

    This works great but I am having issue with my Filter statement:

    CREATE TABLE #DLFiltered(

    [OrigConsID] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [OrigConsName] [nvarchar](101) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [ConsultantID] [nchar](13) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,

    [Downlinelevel] [int] NULL,

    [ConsultantName] [nvarchar](101) COLLATE...

  • RE: TEMP Tables

    I created the Temp Table but how would I change my current code into the INSERT Statement:

    Current COde:

    Select 'OrigConsID' = @ConsultantID

    ,(Select Top 1 FirstName + ' ' + LastName...

  • RE: MAX Date question

    This is the code that seems to make it work appropriately:

    Select DISTINCT t.ConsultantID,

    t.ConsultantName,

    t.CurrentLevelXID,

    MAX(t.EffectiveDate) AS EffectiveDate,

    s.Title,

    t.NACDate,

    t.BillToState,

    t.HomePhone,

    t.SponsorXID,

    t.SponsorID,

    c.FirstName + ' ' + c.LastName AS SponsorName,

    t.DeactivationDate,

    t.Active

    ,t.ReactivateDt

    from #Temp3 t

    Left Outer Join Consultant c ON...

  • RE: NULL filter does not work

    Not a problem. I will start doing that in the future.

  • RE: NULL filter does not work

    Geez. Well it is Monday!!! Thanks a lot that worked.

  • RE: Insert not working from Access to SQL

    I figured out that that one of the columns was typed wrong. After I corrct that everything started to work. Thanks.

Viewing 15 posts - 46 through 60 (of 258 total)