Forum Replies Created

Viewing 15 posts - 4,111 through 4,125 (of 8,731 total)

  • RE: Moving values to fill in nulls.

    I'm not sure if this is a good idea:

    WITH rCTE AS(

    SELECT s.saleid, u.userid, b.businessunitid, b.name, b.parentbusinessunitid, 1 AS n

    from ...

  • RE: DUPLICATE Records

    jkramprakash (9/25/2015)


    Thank you

    You're welcome.

    However, do you understand the solutions?

  • RE: Convert Cursor to a Recursive CTE or a normal Query

    You make it very difficult to help you. You only post a part of your code which doesn't seem to require a cursor or recursive query at all.

    You might...

  • RE: Help me with the SYNTAX for the DELETE statement

    mw112009 (9/24/2015)


    Beleive me, the LEFT OUTER JOIN is faster.

    I deal with large tables and the "EXITS" make the query run for hours..

    Are we supposed to take your word for granted...

  • RE: Are the posted questions getting worse?

    jasona.work (9/25/2015)


    Grant Fritchey (9/25/2015)


    jasona.work (9/25/2015)


    I've been wanting to pile into that topic, but keep restraining myself...

    Hmm. Maybe we need to Godwin that topic, and bring in a comparison somehow...

  • RE: When IsNumeric not numeric?

    Kristen-173977 (9/24/2015)


    Vic Rauch-303403 (9/24/2015)


    CONVERT(varchar,

    I recommend that you don't rely on the default size for varchar, there is some strange behaviour which will catch you out from time to time.

    I use...

  • RE: Pivot, NestedPivot, unPivot?

    Use a CASE statement.

    CREATE TABLE #Milestonetable(

    JobNo INT,

    MileStoneName CHAR(1),

    ForecastDate DATE,

    ActualDate DATE,

    ...

  • RE: Pivot, NestedPivot, unPivot?

    shorton2 (9/24/2015)


    Any way to tell where I'm getting this warning from:

    Warning: Null value is eliminated by an aggregate or other SET operation.

    That comes from all the MAX() functions. Nothing to...

  • RE: DUPLICATE Records

    Or avoid the JOINs.

    WITH CTE AS

    (

    SELECT id, num, COUNT(*) OVER(PARTITION BY id, num) dup_cnt

    FROM @t

    )

    DELETE c

    --SELECT *

    FROM cte...

  • RE: Pivot, NestedPivot, unPivot?

    Remember that SELECT INTO will create a new table each time. To add the INTO clause, just include it before the FROM as you would with a normal query. You...

  • RE: Order of predicates

    GilaMonster (9/24/2015)


    Alan.B (9/24/2015)


    Just as a side note, this won't fail:

    WITH X AS

    (

    SELECT fld

    FROM #t

    WHERE cast(fld as int) > 0

    )

    SELECT fld

    FROM X

    WHERE ISNUMERIC(fld) =1

    Since the optimiser pushes predicates down...

  • RE: Survey: Number of Beers per Power Outage?

    I'd go up to four. 😎

  • RE: Order of predicates

    T-SQL is a declarative language, which means that you're not telling the engine how to process the query, you just tell it what you want it to do. That means...

  • RE: Pivot, NestedPivot, unPivot?

    That's the way to do it. However, if you're hard coding the milestones, there's no reason to use the dynamic code. But that's the place where you would filter either...

  • RE: Pivot, NestedPivot, unPivot?

    If you can query the specific milestones, you can limit them.

Viewing 15 posts - 4,111 through 4,125 (of 8,731 total)