Forum Replies Created

Viewing 15 posts - 4,156 through 4,170 (of 7,613 total)

  • RE: SQL Code QA

    Phil Parkin (9/15/2016)


    Brandie Tarvin (9/15/2016)


    Fast.Eddie (9/7/2016)


    Good Afternoon All, This is my first post.

    I created the below code and if works fine. However my DBA said "It does the job but...

    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 Code QA

    Back to the original post, that code looks far better than most of what I see as a DBA!

    Just one serious change, to get rid of the CAST of/function against...

    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: asyncronous sql queries?

    Keep in mind, though, that you could use non-temp table names in tempdb. Tables will have slightly less overhead in tempdb.

    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: is there a way to select column data for columns with an ordinal position < a particular ordinal position?

    It sounds like you have typical "createdate", "createuser", 'updatedate", "updateuser" that you want to exclude.

    But do it by column name rather than position. Those won't necessarily be the last...

    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: Need Trigger Script

    trigger should get columns from sys.columns and I need to create similar triggers for many tables

    No, it should not! That's far, far too much overhead.

    The trigger should 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".

  • RE: Add columns to multiple tables

    tshad (9/12/2016)


    True.

    That could be an issue if you have rows that large. I have a customer where some of out tables column definitions exceed the row size by hundreds...

    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 columns to multiple tables

    tshad (9/10/2016)


    Which is why, as I mentioned, I use both. I use audit tables on the tables I need to audit but I also have 5 columns on all...

    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: Ensuring logins are not used

    Also maybe check:

    SQL Jobs (who knows, maybe a yearly job)

    SSIS data sources / SSIS packages

    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: Indexing - Should primary key be a natural key or an identity?

    The other really huge performance factor to consider is how the tables are joined. Often natural keys allow for merge joins, which are extremely efficient even on very large...

    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 columns to multiple tables

    You can add all 5 columns to a given table in one statement, but you need separate statements for each 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: Indexing - Should primary key be a natural key or an identity?

    I reject entirely the notion that there is such a thing as a "default" clustering key. That is the issue to me. While certainly there are times when...

    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: Why does the query optimizer choose this way?

    If the overall number of pages to be read is small either way, it's just not worth the optimizer's time to keep going.

    SQL naturally favors the clustered index. Overall...

    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

    Sean Lange (9/2/2016)


    ScottPletcher (9/2/2016)


    A clustering index is enough to avoid having a heap, you don't have to have a primary key. In particular, don't slap an identity column 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".

  • RE: How to get list of all tables/index that are not compressed for all Databases in an instance

    Don't have time right now to fully test/refine this, but it should be close at least:

    SELECT DISTINCT

    SERVERPROPERTY('servername') [instance]

    ,DB_NAME() [database]

    ,QUOTENAME(OBJECT_SCHEMA_NAME(p.object_id)) +'.'+QUOTENAME(Object_name(p.object_id))

    ,p.data_compression

    ,p.data_compression_desc

    FROM sys.partitions p

    INNER JOIN (

    SELECT container_id, SUM(total_pages)...

    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

    A clustering index is enough to avoid having a heap, you don't have to have a primary key. In particular, don't slap an identity column on the table just...

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