Forum Replies Created

Viewing 15 posts - 4,036 through 4,050 (of 4,080 total)

  • RE: COMBINE ROWS OF ONE TABLE

    It ain't pretty, but it's a start. This will run faster than doing it with a cursor or a while loop.

    You'll probably need to create another cte...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Converting rows into columns

    Maynor, looks like you need to PIVOT. There is another recent thread on that subject. Check it out.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Re: EXCEPT vs. NOT EXISTS

    Left Joins or WHERE NOT EXISTS are the ways to go. Here's why.

    I ran a little experiment using the LEFT JOIN technique versus EXCEPT. The...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: How do I create a conditional counter?

    CREATE TABLE #Conditional

    (

    StartDate datetime,

    value float,

    x int

    )

    INSERT INTO #Conditional

    VALUES ('08/10/2008 01:48', 3, 0) -- starting out with a zero value in the new "x" column

    etc

    --------------------------------

    declare @b-2 int

    set @b-2...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Re: EXCEPT vs. NOT EXISTS

    Jack's right. Good eye!

    For what it's worth, I always use the left join format too. It's simple to remember, fast to execute, and easy...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Re: EXCEPT vs. NOT EXISTS

    Well, to start with the outputs are different. Exists returns a true/false value, whereas except returns a set of 0-n rows. Why would you...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: select count

    This is not an optimal table design for doing what you want in SQL. It would be easier if your table was like this:

    userName ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Condensing an improperly written SP

    From the looks of things, all but two of the subqueries in your WHERE clause are used only to determine if a column has a match in another table. ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: How to create trigger for custom Primary Key field?

    Shame on you.

    You are taking what should be three different columns and making one column out of them. Keeping date and sequence separate in your db...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Optimizing Physical Temp Tables

    If you simply truncate a table, indexes still exist but are empty. They are reloaded when you reload the underlying table.

    Yes, building or loading indexes takes work, which...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: SQL Query - join table

    Okay... so much for theory. I ran the code at the bottom (without DBCC FREEPROCCACHE or DBCC DROPCLEANBUFFERS) and saw no significant IO differences against the base...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Updating table based on coalesce reults in where clause?

    My bad. I didn't catch that the middle post was also from you. I see how using "AA" without a term qualification got you where...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Updating table based on coalesce reults in where clause?

    Hey Craig:

    By definition, in your joins, "A" only produces a set of rows for Fall 2008, just as "A2" can only return Summer 2008. As...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Opinions on putting Insert and Update code into same proc

    I've seen it done both ways. No best answer, it really depends on whether or not there is a hard and fast rule that says if-exists-then-update/if-not-exists-then-insert. ...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • RE: Speed or Value?

    Nobody has unlimited budgets, so price is always a limiting factor. Therefore I cast my vote on the price/performance side of the house. Not that he needs...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 15 posts - 4,036 through 4,050 (of 4,080 total)