Forum Replies Created

Viewing 15 posts - 1 through 15 (of 7,626 total)

  • Reply To: Force join by longest possible choice

    You're welcome!  Very glad it helped.  Thanks for the nice feedback.

    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 Server Storage Optimization: Multiple Files in a Filegroup vs Dedicated File

    Honestly, I think the biggest payback will be from page compressing the data (whether you use separate filegroups or not).

    As always, it's vital to have the best clustered index 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: Force join by longest possible choice

    For example,

    SELECT t1...., ca1....
    FROM dbo.table1 t1
    CROSS APPLY (
    SELECT TOP (1) ...
    FROM dbo.table2 t2
    WHERE t2.column LIKE...

    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: Force join by longest possible choice

    Yes.  Use a CROSS APPLY or OUTER APPLY (rather than a JOIN) with a TOP (1) ORDER BY LEN(<matched_column>) DESC

    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: A design question in a parent child relationship

    b) there could be an issue if the flag in the Task table doesn't match the data in the vendors table. In other words, if the task is marked complete,...

    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: A design question in a parent child relationship

    Option 1 has performance issues.

    Not necessarily.

    Qs:

    1. Are all Vendors added to the Task when the Task is created, or can Vendors be added later?
    2. Can a Task be "Uncompleted"?  That...

    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: Querying Multiple Tables for the Same Information

    Dynamically create a view that references all the applicable tables at the moment your code started running.

    For example, roughly like this.  [Edits in italics] You didn't give any real details...

    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: Massive Table Growth Issue – How to Set Up Filegroup Usage Alerts?

    To make it (much) less fragile, I would likely automate the creation of the Alerts by using a proc, via sp_add_alert.

    The proc would take in the % size as 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".

  • Reply To: Massive Table Growth Issue – How to Set Up Filegroup Usage Alerts?

    You can create a standard SQL alert that is based on the db size (in KB) exceeding whatever amount you specify.

    In SQL Server Agent; "Alerts"; "New Alert"; "SQL Server performance...

    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: STRING_AGG DISTINCT

    Interesting q.  No, haven't done that.

    I guess easiest would be to use a subquery, which you're already familiar with, so that's not what you're looking for, but just 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".

  • Reply To: In-place OS upgrade or migration to new OS?

    Definitely use new VMs.  Too many installation settings could matter here.  The new VM approach also allows you to test with a db to two without having to wait 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: Partitioning a table with TEXTIMAGE_ON option

    No, I don't think you would.  I don't think TEXTIMAGE_ON clause is allowed is a partition scheme is used (based on MS documentation).  Sorry, I don't have time to test...

    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: Using IFF within a WHERE clause

    Don't need IIF, just standard WHERE NOT:

    WHERE NOT (Customer between 99202 and 99215 and State = 'NY')

    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: Increment a number in a SQL Query based on a value

    Sounds like you could use a SEQUENCE.  For example:

    CREATE SEQUENCE dbo.bom_sequence AS int START WITH  9000000 INCREMENT BY 1 NO CYCLE ;

    SELECT CASE WHEN item_number = ''...

    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: Dealing with huge heap tables

    A leading datetime clustering key would not be a problem at all, i.e., there's no reason to exclude a datetime from a clustering key.  As you, and others, have noted,...

    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 through 15 (of 7,626 total)