Forum Replies Created

Viewing 15 posts - 3,676 through 3,690 (of 7,613 total)

  • RE: Subquery vs join

    There actually is, in theory, a fundamental difference between those queries:

    The first query will drop/ignore any row that does not have a matching row in the Account table,...

    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".

  • RE: Check for existense of database master key in "all" databases

    I suggest you do it this way, which will make the output easier to use (at least for me):


    DECLARE @command varchar(1000)
    SELECT @command = '

    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".

  • RE: Choosing the Birthday of a Customer by month?

    Jeff Moden - Friday, November 24, 2017 9:13 AM

    ScottPletcher - Friday, November 24, 2017 8:02 AM

    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".

  • RE: Choosing the Birthday of a Customer by month?

    It makes zero sense to pull out just the month and index it.  You'd be far better off indexing the date with a dummy year.

    And if one (almost)...

    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".

  • RE: Choosing the Birthday of a Customer by month?

    Lynn Pettis - Wednesday, November 22, 2017 12:48 PM

    ScottPletcher - Wednesday, November 22, 2017 12:44 PM

    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".

  • RE: Choosing the Birthday of a Customer by month?

    Lynn Pettis - Wednesday, November 22, 2017 12:34 PM

    ScottPletcher - Wednesday, November 22, 2017 12:25 PM

    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".

  • RE: Choosing the Birthday of a Customer by month?

    Lynn Pettis - Wednesday, November 22, 2017 12:05 PM

    I'd rather store the date as a date and use computed columns if I...

    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".

  • RE: Does anyone use views in this way?

    I have used views for that, but only for a very limited number of values, since it can't be effectively indexed.

    Unique indexes are potentially extremely valuable, even for...

    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".

  • RE: Choosing the Birthday of a Customer by month?

    Or take a step back and consider whether "dob" shouldn't be stored as separate columns to begin with, in accordance with standard data normalization (if you need to constantly look...

    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".

  • RE: Statistics for crud operation

    While it's still available in the cache, just at it would be for index_usage_stats, you can likely use:
    sys.dm_db_index_operational_stats

    If the table is active, that data is very...

    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".

  • RE: Add New Column Based on Criteria

    As a very slight simplification, you could also do this (I prefer CAST when possible since it's ANSI-standard, whereas CONVERT is not):

    CAST((CP + 9) / 10 AS int)

    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".

  • RE: Date

    adisql - Friday, November 17, 2017 10:08 AM

    Hi,

    I would like to add new variable(Current Complete Week -1) to the SP for below...

    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".

  • RE: A different end table by parameter

    davidvarga086 - Monday, November 20, 2017 1:55 AM

    ...someone thought that we should add a weekly version to it, but if I add...

    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".

  • RE: Index Key Re-Ordering

    The key thing to remember is this:
    Data does not have to stored in physical sequence in order to be able to read in key sequence.

    That is, the...

    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".

  • RE: Trying to convert a int @variable to a varchar @variable with leading zero.

    drew.allen - Thursday, November 16, 2017 11:30 AM

    ScottPletcher - Thursday, November 16, 2017 10:47 AM

    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 - 3,676 through 3,690 (of 7,613 total)