Forum Replies Created

Viewing 15 posts - 2,626 through 2,640 (of 7,619 total)

  • Reply To: does WITH (NOLOCK) hint in Select statement really make a difference?

    Chris Harshman wrote:

    ScottPletcher wrote:

    Chris Harshman wrote:

    NOLOCK probably does not do what you think it does.  It still will take out locks for itself on the tables you are querying

    I don't think so. ...

    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: does WITH (NOLOCK) hint in Select statement really make a difference?

    Chris Harshman wrote:

    NOLOCK probably does not do what you think it does.  It still will take out locks for itself on the tables you are querying

    I don't think so.  Where did...

    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: Multi-column pivot table help

    CREATE TABLE #table_1 (
    last_updated date NOT NULL,
    type_desc varchar(30) NULL,
    size_bytes bigint NULL,
    used_bytes...

    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: does WITH (NOLOCK) hint in Select statement really make a difference?

    Chris Harshman wrote:

    Other than some advanced troubleshooting cases like Jonathan says, there is no reason you should use NOLOCK in your code.

    NOLOCK probably does not do what you think it does. ...

    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: I am looking to optimize this T-SQL Statement (it generates very High Reads..)

    All indexes are tuned to their best (for the current statement)

    I'd rather see the actual indexes and the actual query plan for myself.

    For example, how many rows are in #GRatings...

    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: result in same line

    No usable sample data, so I can't test it, but this should give you the results you want:

    SELECT $month_of_year, $day_of_month,

    SUM(CASE WHEN status ='success' THEN 1 ELSE 0...

    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: Using CASE Statement to SET variable when null value

    drew.allen wrote:

    You're also better off just inserting the 'No Comments Provided' when you create the record instead of going back and updating the record later.

    Drew

    True, but even better would be...

    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: Relational Table SQL Query Optimization/Performance Issue?

    True, but that table only has 75K rows.  Create an index with only CommodityID and CommodityName and, yes, SQL will still have to do an index scan, but the overall query...

    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: Relational Table SQL Query Optimization/Performance Issue?

    To help resolve this problem across the board, for all your queries, you really need to re-cluster the CommoditySupplier table.  This is a classic case of the "default clustering by...

    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: Issue with left join

    WHERE DS.IsActive = 4 AND Std.DepartmentId IS NULL

    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: T-SQL query to get the latest available backup chain

    Jeff Moden wrote:

    Estimating the space requirement for database restores from the backup size can be really misleading.  One of the largest problems in this area is that free space in 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".

  • Reply To: How to use replace function

    Be aware, too, that an int column could require up to 10 bytes to store its value.  It's not safe to limit your result from this column to just 8...

    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: Temp Tbl

    Now, multiple online articles suggest to use only when data is huge and not for small amount of data

    To put it simply, that's just wrong.  If you need to create...

    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: Transaction handling in sql server

    I'd suggest always using SET XACT_ABORT ON.

    (1) Otherwise, you can't be sure which part(s) of a transaction completed and which didn't.  Sometimes the entire transaction will be failed even 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: how to merge 3 different temp tables data into one

    Oops.

    You still don't need a temp table.  Instead:

    INSERT INTO ...

    SELECT ...

    UNION

    SELECT ...

    UNION

    SELECT ...

     

    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,626 through 2,640 (of 7,619 total)