Forum Replies Created

Viewing 15 posts - 2,056 through 2,070 (of 7,619 total)

  • Reply To: Access to SQL expression

     

    SELECT
    string_to_parse,
    CASE WHEN first_dash = 0 THEN ''
    WHEN first_dash = last_dash...

    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: TSQL Script: Min, Max function

    This looks to me like a Gaps and Islands query.  Itzik Ben-Gan has posted numerous articles and written in books how best to solve those types of queries.

    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: Create Unique combination as Key out of N columns

    Jeff Moden wrote:

    ScottPletcher wrote:

    Jeff Moden wrote:

    You have some values that have leading zeros.  Must the leading zeros be preserved?  If so, then not all of the columns are actually INTs as 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".

  • Reply To: Create Unique combination as Key out of N columns

    nvm, OP obviously not interested at all in this approach.

    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: Build hierarchy multi-column table on data in 1 column based on string length

    Jeff Moden wrote:

    FL0XN0X wrote:

    I was too enthousiastic. What I did was I only took the 7 character long records (WHERE LEN(column1)=7) and then applied the LEFT functions as indicatde above. 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".

  • Reply To: Create Unique combination as Key out of N columns

    Jeff Moden wrote:

    You have some values that have leading zeros.  Must the leading zeros be preserved?  If so, then not all of the columns are actually INTs as you said.  Let...

    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: Help getting last 2 entries from split string with variable number of splits

    Jeff Moden wrote:

    ScottPletcher wrote:

    This has less overhead... 

    Just curious, Scott... how are you measuring "overhead" for this?

    Actually, for this one, I just looked at the query plans.  The other code is doing...

    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: Help getting last 2 entries from split string with variable number of splits

    This has less overhead, which may or not be a concern to you for this task, but I thought I'd post it just in case.

    ;WITH cte_find_last_2_dashes AS...

    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: Build hierarchy multi-column table on data in 1 column based on string length

     

    CREATE TABLE #3NF_ATCCOLLECTION 
    (
    ATC_KEY varchar(7) NOT NULL
    );
    INSERT INTO #3NF_ATCCOLLECTION VALUES
    ('A10'), ('A10Q'),...

    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: Perf hit for Increasing tran log frequency

    Jeff Moden wrote:

    To answer the question, you could instead change the criteria you cited to...

    AND log_reuse_wait_desc <> Nothing'

    Like I said in the comment in 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".

  • Reply To: Perf hit for Increasing tran log frequency

    Jeff Moden wrote:

    TangoVictor wrote:

    we are currently doing a 1 hour tran log backup for a system, I'd like to push that up to 1 minute. Is there a performance hit 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: Extract data with variable column names and order

    The big disadvantage I see for dynamic-only code is that you can't analyze them at all, whereas with views you can.

    For example, "How many Configs use 'Integer3'?" or "Do we...

    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: Create Unique combination as Key out of N columns

    Has to be calculated in runtime so i cant just place them into a table and use identity column

    Not following you there.  Why can't you look up the "meta-key" from...

    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: Creating indexes on a very large table takes over 5 hours

    Jeff Moden wrote:

    ScottPletcher wrote:

    The ORDER BY is useless (rather than "absolutely essential").  ORDER BY doesn't control the order of physical INSERTs into a table, only the assignment of identity values.  I've...

    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: Extract data with variable column names and order

    Actually I intended by code to be run anytime the Config for a given AttributeType was modified.  After the initial build for every AttributeType in Config, I expected it typically...

    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 - 2,056 through 2,070 (of 7,619 total)