Forum Replies Created

Viewing 15 posts - 3,946 through 3,960 (of 7,613 total)

  • RE: redesigning table to accommodate new data types

    Don't model the code or the logic, model the data.  Do logical modeling first, then convert that to a physical model.  Don't just start out with a physical...

    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 do I state my foreign key in my Create Table?

    Frankly, the attitude wouldn't bother me so much if what he was posting made sense in the real world.  But it just doesn't.  Making identifier values character(10) simply because you...

    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: Converting Numbers to Letters

    Why avoid 26 REPLACEs?  They perform pretty well; I guess unless maybe you have a huge number of rows?!

    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: Converting Numbers to Letters

    You might be able to do something simpler, depending on your specific data and requirements:


    SELECT
      [Keys],
      REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
      REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
      REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
      REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(
     ...

    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: Optimizing a query

    Btw, I also added a clause to the TAC join:

    LEFT JOIN [dbo].[Contacts] TAC WITH (NOLOCK) ON SAC.Owner_Id IS NULL AND ...

    You might gain some slight efficiency...

    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: Practice T-SQL

    Look for articles or books by Itzik Ben-Gan.  The books are better overall for training, although they will cost you a few dollars.

    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: Optimizing a query


     SELECT S.Id,
       T.Id,
       COALESCE(SAC.Contacts_Id, TAC.Contacts_Id) AS AssignedContacts_Id,
       COALESCE(SAC.OwnerType, SAC.OwnerType) AS OwnerType,
       COALESCE(SAC.ContactsId, TAC.ContactsId) AS ContactsId,
       COALESCE(SAC.Description, TAC.Description) AS Description
      FROM [dbo].[ChildTable1] S 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".

  • RE: how to select only non null columns out of 100 plus columns table

    You can use a CROSS APPLY to adjust the row to make it much easier to analyze values.  I can't give you more details than this right now because your...

    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: Index Performance

    You need to look at some actual stats, from the system views SQL provides, rather than just guessing.

    The sys.dm_db_index_* and sys.dm_db_missing_index_* views can give you valuable stats 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: redesigning table to accommodate new data types

    You don't want to store a string, use a numeric code instead; strings would be a huge waste of resources and are harder to change  Also, I'd separate the present/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: Is not null 2 columns...

    jcelko212 32090 - Friday, February 17, 2017 7:21 AM

    ScottPletcher - Thursday, February 16, 2017 4:54 PM

    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: LCK_M_U delete 4999 rows.

    charliex - Friday, February 17, 2017 6:56 AM

    ScottPletcher - Thursday, February 16, 2017 4:38 PM

    How...

    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: Joining INSERTED and UPDATED tables when PK column changes

    sgmunson - Thursday, February 16, 2017 9:25 PM

    ScottPletcher - Thursday, February 16, 2017 4:48 PM

    You...

    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 not null 2 columns...

    jcelko212 32090 - Wednesday, February 15, 2017 3:32 PM

    89netanel - Thursday, February 2, 2017 3:05 AM

    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: Joining INSERTED and UPDATED tables when PK column changes

    You could add a unique identity column without touching the existing primary key, and that identity value would still allow you to join the deleted and inserted tables accurately.

    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 - 3,946 through 3,960 (of 7,613 total)