Forum Replies Created

Viewing 15 posts - 1,141 through 1,155 (of 7,613 total)

  • Reply To: Alter default SQL generated in context menu top 1000

    If ID is (nearly) always an identity column, you can use ORDER BY $IDENTITY, that way you don't need to know the exact column name.

     

    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: New Index Maintenance Methods Recommended by Microsoft

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    As a bit of a sidebar, wouldn't adding more files add to the problem you spoke of previously?

    I'm not sure which specific "problem" you're referring...

    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: Two identical queries have different execution plans (one cursor one not)

    It actually does explain it.  If SQL has to do a sort to get the rows in the correct order, then the cursor would be required to do a sort...

    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: Two identical queries have different execution plans (one cursor one not)

    Sorry to have bothered you then.  Good luck with this.  (I believe if you changed your cursor to LOCAL FAST_FORWARD (as in standard in SQL Server unless you explicitly need...

    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: Two identical queries have different execution plans (one cursor one not)

    You should change the index so that it has the proper sort order already, which will (should) avoid the sort in the query:

    CREATE NONCLUSTERED INDEX [IX_ImageProduct_MID] ON...

    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: New Index Maintenance Methods Recommended by Microsoft

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    As a bit of a sidebar, wouldn't adding more files add to the problem you spoke of previously?

    I'm not sure which specific "problem" you're referring to.

    The one...

    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: Query runs slow sometimes and sometimes runs superfast (2 minutes vs 2 seconds)

    Jeffrey Williams wrote:

    This is not going to allow index usage in the join: AND KeyValue = (co.co_num + '-' + CAST(coitem.co_line AS VARCHAR(10)) + '-0' )

    SQL can use an index 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".

  • Reply To: SQL query help

    jcelko212 32090 wrote:

    fake_pointer ???? NOT NULL);

    The reason you are using big integers is because they look like pointers. But we don’t use pointers in RDBMS. You’re using SQL to write assembly...

    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: New Index Maintenance Methods Recommended by Microsoft

    Jeff Moden wrote:

    As a bit of a sidebar, wouldn't adding more files add to the problem you spoke of previously?

    I'm not sure which specific "problem" you're referring 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: Need help optimizing TSQL

    rothj wrote:

    But when Jonathon added both columns the WHERE clause, it might have taken care of it.

    c.CustomerNumber = t.CustomerNumber AND c.Customer = t.Customer

    Jonathon, your second query brought the spool back. ...

    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: Need help optimizing TSQL

    rothj wrote:

    Agreed, the NOLOCK was already on my radar.

    Removing NOLOCK would only slow down the process, never speed it up.  I'm not saying you should or shouldn't use it here...

    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: Need help optimizing TSQL

    Jonathan AC Roberts wrote:

    I don't understand what you are trying to do or your data. But I think the part:

    Bank = (Select Bank From Customer Where Customer=t.Customer)

    is redundant.

    I'm not...

    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: Query runs slow sometimes and sometimes runs superfast (2 minutes vs 2 seconds)

    What indexes do you have on that table?

    Looks like an index on ( MessageType, NewValue, KeyValue, RecordDate ) INCLUDE ( CreateDate, OldValue )

    might be useful for this 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: New Index Maintenance Methods Recommended by Microsoft

    Jeff Moden wrote:

    You're presuming an awful lot.  Why would you want "at least 2 files per filegroup" for a single table?

    To spread the I/O out, the typical reason for multiple files...

    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: New Index Maintenance Methods Recommended by Microsoft

    I still have to think about this.  We have hundreds of dbs.  Say anywhere from 3 to 24 large tables in each db, a separate fg for each.  Presumably you'd...

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