Forum Replies Created

Viewing 15 posts - 481 through 495 (of 1,473 total)

  • RE: More recent rows by user

    I can suggest an alternative method depending on how that one performs on your real table. Let us know how it goes once you get it all re-wired.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Looking for Input on Use of WHILE Loop In Job Step

    Assuming that the real code will use DATEADD instead of +1 to modify the dates, it seems like it would work better. What determines the values that you still...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Not in

    timscronin (10/20/2009)


    I guess the whole question which is more efficient, not in, not exists, left join

    AFAIK, there's no straight answer to that question. Each of them written correctly can...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Incrementing / identity without identity insetr

    Check out ROW_NUMBER, which Andras also mentioned in his post.

    Here's a hint: ROW_NUMBER() OVER (PARTITION BY Customer_ID ORDER BY Customer_ID)

    Edit: Typo.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: "Subquery returned more than 1 value" with a twist

    Try running this.

    SELECT T1.Val3, T3.Val2, COUNT(T3.Val1)

    FROM Table1 AS T1

    INNER JOIN Table2 AS T2 ON T1.SomeID = T2.SomeID -- Fixed Join, you have T1=T1

    LEFT JOIN Table4 AS T4 ON T4.SomeID =...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Getting an "extra" field from the result of a GROUP BY

    IIRC, varchar values are compared by looking at the ANSI values of each character going from left to right.

    DECLARE @a TABLE(vc varchar(20))

    INSERT INTO @a(vc)

    SELECT 'bafeajk' UNION ALL

    SELECT 'abfaefafea' UNION ALL

    SELECT...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: "Subquery returned more than 1 value" with a twist

    And by the way. I experimented with just rewriting the query so that the subquery is a left join in the outer query and it works just fine every time....

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: IDENTITY Columns, INSERT INTO, and ORDER BY

    The article I does only cite 7.0 and 2000, but although many tests might show it works just fine, that by no means makes me confident that the issue was...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: How to get the rest of top 5 records?

    This was my source for it not being guaranteed:

    http://support.microsoft.com/kb/273586

    I actually just found that about a week ago so it was fresh on my mind.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: How to get the rest of top 5 records?

    Oops, good catch Tom.

    Also, Hal, I'd think about Bob's solution. The table may be small now and the performance difference minor, but as it grows, so would the difference...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Formula For Column (Beginner Question)

    You should be able to make that case statement a calculated field so that you don't need to actually update it. The field is automatically updated as soon as...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Order by specific word, then alphabetically

    Something like this:

    ORDER BY CASE WHEN Col='Other' THEN 1 ELSE 2 END, Col

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: How to get the rest of top 5 records?

    Does this return the correct results?

    select count(1) as total, mn1.category from Metric m1

    inner JOIN Manager mn1 ON mn1.[Login] = m1.createuserid

    where m1.status = 'Pending' and type = 'updateTargetAccountPassword'

    mn1.category not in...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Trigger , SET IDENTITY_INSERT ON and OFF Problem

    And at that point, you've just lost even the 'perceived' benefit of manually inserting the identity column, because it won't link. Identity columns exist so that you don't have...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • RE: Rowcount for subset of data in temp table

    You did it perfectly, thank you. So, this gets you to where you were before, maybe a bit farther, and uses joins. I'd ditch the create table(just use...

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

Viewing 15 posts - 481 through 495 (of 1,473 total)