Forum Replies Created

Viewing 15 posts - 1,591 through 1,605 (of 7,613 total)

  • Reply To: How to find unique values in a table

    Mr. Brian Gale wrote:

    Scott - I agree that NOLOCK has its purposes, as do all query hints.  Otherwise they wouldn't be in there to begin with.  I was just trying to...

    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: Conditional where clause

    You don't need the extra check on the flag:

    WHERE @myFlag <> 1 OR name NOT IN ('A', 'C')

    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: Non clustered index fragmentation problem

    If the DLRID are mostly unique, or mostly come in batches together when not unique, I suggest encoding the DLRIDs into a numeric code.

    That is, create a separate table with...

    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: Very strange hanging process...

    CXCONSUMER is waiting on parallelism.

    Have you adjusted the SQL Server configuration for 'cost threshold for parallelism' to be something larger than the default?  The default is 5, IIRC, which 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: SQL 2016 - Need help with complex calculations based on paycodes !

    That's easy enough, you can pre-calc a proper date range, using either variables or in a cte.  I'll use variables here just because they're easier to adjust for diff test...

    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: SQL 2016 - Need help rearranging the output

    To be absolutely sure of correct matches, you'll need something to sequence the rows so that you know the specific order of the rows.  I added an id for that,...

    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: Minimum permission for user to grant execute on a stored procedure they created

    Try this:

    GRANT EXECUTE ON xyz.SPName TO LocalSQLaccount AS ADGroup;

    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: Dynamic Alert query

    gjoelson 29755 wrote:

    Scott, thanks.

    Not sure that would work in our case, also not quite  sure it it would address the ability to suppress certain reports and reset etc.

    SQL alerts have...

    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: SQL 2016 - Need help with complex calculations based on paycodes !

    DiabloSlayer wrote:

    Thank you Scott for the help, this was very close but when I ran it, I got 8 hours of SICK twice for example # 1.

    Thanks again !

    DS

    Oops,...

    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: Index rebuild

    Sergiy wrote:

    ScottPletcher wrote:

     Clustered index scans should definitely be adversely affected by masses of empty space in pages from deleted rows, since the scan will have to read lots more...

    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: SQL 2016 - Need help with complex calculations based on paycodes !

    See if this gives you the correct totals.  I have not taken performance into consideration yet, just trying to get the correct result.

    Be sure to add a date check to...

    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: Identify Indexes hurting performance

    (1) Agree with ZZ.

    (2) Yes, but you will also need to look at missing index stats at least, possibly cardinality data and index operations stats too.

    (3) Yes, sort of.  index...

    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 find unique values in a table

    Mr. Brian Gale wrote:

    Unless your table is named "sol(nolock)", I would avoid using NOLOCK.  It is in my coding standards that NOLOCK should be avoided except where potential data inaccuracy is acceptable...

    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 find unique values in a table

    Note, too, that the OP did not indiscriminately use NOLOCK everywhere.

    In fact, it was used on only 1 table out of 9 (or so).

    To me, that is exactly the way...

    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 find unique values in a table

    Mr. Brian Gale wrote:

    And I agree 110% with pietlinden on the NO LOCK hint.  I would avoid using NOLOCK.  It is in my coding standards that NOLOCK should be avoided except where...

    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 - 1,591 through 1,605 (of 7,613 total)