Forum Replies Created

Viewing 15 posts - 2,296 through 2,310 (of 7,619 total)

  • Reply To: Wanting to learn

    Get the best SQL administration book for whichever version of SQL you are on.  The "Inside SQL Server"/Internals books with Kalen Delaney are excellent.

    For learning T-SQL, get books by Itzik...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Compression Table vs Index and how to eliminate fragmentation

    To clarify, you can compress non-clus indexes, and should often do so, but you must compress each one separately.

    Also, 80% is a very low number overall, are you sure you...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: How do I utilise fewer cores?

    Be sure also to make sure the "cost threshold for parallelism" is not too low.  Hint: the default is too low, if you haven't changed it,  you should.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Joining a table based on date range - Case Statement?

    5. Avoid using reserved words as column names (PERIOD)

    PERIOD is not a reserved word in SQL Server. (Nor is it reserved in ODBC, also not on the list of future...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Complex Join

    Sorry, I had some difficulty figuring out specifically what you meant.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: How to prioritize the phone nos values in three columns.

    SELECT CustID, COALESCE(CASE WHEN ValidLand = 0 THEN NULL ELSE LandPhone END,

    CASE WHEN ValidMobile = 0 THEN NULL ELSE MobilePhone END,

    CASE WHEN ValidOffice = 0 THEN NULL ELSE OfficePhone END)...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: How to prioritize the phone nos values in three columns.

    SELECT CustID, COALESCE(LandPhone, MobilePhone, OfficePhone) AS Phone

    FROM PHONENOS

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: First Monday of the Month

    Such insanely bloated calendar tables have actually become much closer to the norm.

    It's terrible.  Create a nonwork days table with only the dates in it (you could also add a...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Complex Join

    Jeff Moden wrote:

    ScottPletcher wrote:

    And, if forced to work on that SQL statement, I'd still remove the use of ISNULL, no matter what the comments stated.

    So like I asked before... what would...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Complex Join

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    While I usually and strongly agree that ISNULL shouldn't be used on table columns in a Join, Where, or other column based criteria matching, "It Depends" is...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Complex Join

    Jeff Moden wrote:

    While I usually and strongly agree that ISNULL shouldn't be used on table columns in a Join, Where, or other column based criteria matching, "It Depends" is always a...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Complex Join

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    Sergiy wrote:

    Still there is a shorter version:

    select * 
    from leftTable T1
    join rightTable T2
    on (
    ...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Formatting dates returned in query

    SELECT CONVERT(varchar(10), I.InvoiceDate, 110) AS InvoiceDate

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Complex Join

    Jeff Moden wrote:

    Sergiy wrote:

    Still there is a shorter version:

    select * 
    from leftTable T1
    join rightTable T2
    on (
    T1.C1 =...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • Reply To: Complex Join

    You never want to use ISNULL() in a WHERE or JOIN clause.  The code may be slightly longer the other way, but it could potentially run much faster.

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 15 posts - 2,296 through 2,310 (of 7,619 total)