Forum Replies Created

Viewing 15 posts - 4,321 through 4,335 (of 7,615 total)

  • RE: why we should delete old data and what could be the chunk size for delete 2.5 million records

    If the table is clustered first on that datetime, the purge is easy and it should have very minimal effect on current queries.

    If it's clustered differently, you have a 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".

  • RE: sql swap dated fields

    You probably want to verify that the dates are actually backwards before swapping them:

    update tableA

    set StartDate = EndDate,

    ...

    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: Please help me improve the performance of this query

    Can you give any example of where converting a literal value to appropriate non-unicode literal could ever cause SQL a performance issue?

    Or for dates. Our rule is you convert...

    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: EXECUTE AS question

    chuck.forbes (4/18/2016)


    Are you saying that I should put this restore-capable user account into the db_owner role for the database? I haven't heard of making someone a dbo user (I always...

    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: Please help me improve the performance of this query

    TheSQLGuru (4/18/2016)


    It's absolutely not coding "laziness". It's simply to allow for data type changes later without causing performance issues in the code.

    Completely disagree with the first sentence. And even 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".

  • RE: Please help me improve the performance of this query

    TheSQLGuru (4/18/2016)


    ScottPletcher (4/18/2016)


    TheSQLGuru (4/16/2016)

    New rule: YOU WILL, ALWAYS WITHOUT EXCEPTION, USE EXACTLY THE SAME DATA TYPE AS THE COLUMN TO THE BEST OF YOUR LANGUAGES ABILITY TO DO SO!

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

  • RE: EXECUTE AS question

    Yeah, definitely not 'sa' or some other existing/standard user.

    Create a new user, native SQL user will do if that's available to you, and grant it just the specific permissions it...

    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: Please help me improve the performance of this query

    TheSQLGuru (4/16/2016)

    New rule: YOU WILL, ALWAYS WITHOUT EXCEPTION, USE EXACTLY THE SAME DATA TYPE AS THE COLUMN TO THE BEST OF YOUR LANGUAGES ABILITY TO DO SO!

    THAT IS A HUGE...

    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: ISNULL VS COALESCE on nullible and not null columns Sargability comparison

    TheSQLGuru (4/15/2016)


    ScottPletcher (4/15/2016)


    TheSQLGuru (4/15/2016)


    ScottPletcher (4/15/2016)


    The simplest rules is:

    Never use ISNULL in a WHERE or JOIN clause.

    Whether the column is nullable or not is irrelevant.

    The proper way to code this:

    where isnull(SalesOrderID,-1)...

    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: Data corruption aftermath -- future prevention

    dan-572483 (4/15/2016)


    Excuse me? Are you saying that if a database is mirrored and disk-level corruption occurs the SQL will just pull the data from the mirror??

    And I believe it...

    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: ISNULL VS COALESCE on nullible and not null columns Sargability comparison

    TheSQLGuru (4/15/2016)


    ScottPletcher (4/15/2016)


    The simplest rules is:

    Never use ISNULL in a WHERE or JOIN clause.

    Whether the column is nullable or not is irrelevant.

    The proper way to code this:

    where isnull(SalesOrderID,-1) = 43665...

    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: ISNULL VS COALESCE on nullible and not null columns Sargability comparison

    The simplest rules is:

    Never use ISNULL in a WHERE or JOIN clause.

    Whether the column is nullable or not is irrelevant.

    The proper way to code this:

    where isnull(SalesOrderID,-1) = 43665 --NEVER!!

    is this:

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

  • RE: Use of Trigger on a table which could have 100 hits per second. Will it hamper performance?

    Triggers should always be written for best efficiency first, even if it makes them harder to understand, especially so in your situation, with such heavy usage.

    To keep each trigger as...

    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: Executing Functions From Table Column

    If you just want the static result of a function call to be inserted to the table, use INSERT INTO ... SELECT rather than INSET INTO ... VALUES:

    INSERT INTO tblDashboard...

    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: Indexes for a materialized view prefixed with LB_IDX_

    No, I don't know what would have added those indexes. But I also don't see the relevance of that. Wouldn't normal index analysis -- of missing index stats,...

    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 - 4,321 through 4,335 (of 7,615 total)