Forum Replies Created

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

  • RE: Pivot, NestedPivot, unPivot?

    It seems right to me. Just as a suggestion, whenever you're using more than one table, qualify your columns and use an alias for your tables. This won't change the...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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 ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: DUPLICATE Records

    jkramprakash (9/25/2015)


    Thank you

    You're welcome.

    However, do you understand the solutions?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Pivot, NestedPivot, unPivot?

    Use a CASE statement.

    CREATE TABLE #Milestonetable(

    JobNo INT,

    MileStoneName CHAR(1),

    ForecastDate DATE,

    ActualDate DATE,

    ...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Survey: Number of Beers per Power Outage?

    I'd go up to four. 😎

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • 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...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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