Forum Replies Created

Viewing 15 posts - 4,171 through 4,185 (of 7,613 total)

  • RE: Is it a bad idea to declare a cursor within a TRY block?

    Luis Cazares (9/1/2016)


    drew.allen (9/1/2016)


    First, the mantra is "It's a bad idea to declare a cursor. Period. End of sentence." 😀

    Drew

    Second, cursors can be local or global and the default 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: Add unique valules to a heap

    Look at the missing index stats and the index usage stats to help determine a useful clustered index. Only if no useful clustering key exists, and remember to consider...

    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: Temporary Functions?

    CELKO (9/1/2016)


    ]I've found myself creating loads of functions recently which are typically used for one specific task and rarely required again.

    This is not how we intended SQL to 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".

  • RE: CREATE INDEX statement rollback doesn't behave as expected

    Rollbacks very often take more time than the initial modification. They are only very quick if all the pages are still in memory.

    Are there nonclustered index(es) on the 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: DELETE making SELECT slow in RCSI

    TheSQLGuru (8/31/2016)


    ScottPletcher (8/31/2016)


    TheSQLGuru (8/31/2016)


    The optimizer can and often does (in my experience) introduce a SORT into the query plan on a small table to facilitate a merge join against 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".

  • RE: DELETE making SELECT slow in RCSI

    TheSQLGuru (8/31/2016)


    The optimizer can and often does (in my experience) introduce a SORT into the query plan on a small table to facilitate a merge join against a larger 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: DELETE making SELECT slow in RCSI

    TheSQLGuru (8/31/2016)


    ScottPletcher (8/31/2016)


    TheSQLGuru (8/31/2016)


    ScottPletcher (8/31/2016)


    TheSQLGuru (8/31/2016)


    ScottPletcher (8/31/2016)


    Tarun Jaggi (8/29/2016)


    Hi All,

    I have a table which has million rows and database is set under RCSI. The table has a clustered primary key...

    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: DELETE making SELECT slow in RCSI

    TheSQLGuru (8/31/2016)


    ScottPletcher (8/31/2016)


    TheSQLGuru (8/31/2016)


    ScottPletcher (8/31/2016)


    Tarun Jaggi (8/29/2016)


    Hi All,

    I have a table which has million rows and database is set under RCSI. The table has a clustered primary key on Column1...

    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: DELETE making SELECT slow in RCSI

    TheSQLGuru (8/31/2016)


    ScottPletcher (8/31/2016)


    Tarun Jaggi (8/29/2016)


    Hi All,

    I have a table which has million rows and database is set under RCSI. The table has a clustered primary key on Column1 and 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".

  • RE: DELETE making SELECT slow in RCSI

    Tarun Jaggi (8/29/2016)


    Hi All,

    I have a table which has million rows and database is set under RCSI. The table has a clustered primary key on Column1 and a non-clustered 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".

  • RE: questions about sql

    (1) not sure what that means.

    (2) no. a table can have many nonclustered indexes.

    (4) presumably they mean hierarchy ids, but can't tell for sure, the q is vague enough they...

    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: Temporary Functions?

    Gregory Hart (8/29/2016)


    The below is what I have used in the past to accomplish the need for a Scalar UDF in MS SQL:

    IF OBJECT_ID('tempdb..##fn_CORP_Divide') IS NOT NULL DROP PROCEDURE ##fn_CORP_Divide;

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

  • RE: calculating time difference

    I'd prefer to just add one day to the end date when needed. That seems much "cleaner" than dual 3ms adjustments:

    SELECT

    start_time, end_time, DATEDIFF(MINUTE, start_time,...

    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: Eliminate Duplicate

    Add an extra join condition so you only get a single occurrence:

    ...

    INNER JOIN (SELECT ConsumerID, ConsumerAccountID

    FROM Consumer

    WHERE ConsumerType = 'S') s ON p.ConsumerAccountID = s.ConsumerAccountID

    AND...

    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: Insert Into multiple values from Select plus adding incremental non-Identity

    Did you look at the code I posted?

    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,171 through 4,185 (of 7,613 total)