Forum Replies Created

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

  • 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".

  • Reply To: Creating indexes on a very large table takes over 5 hours

    Jeff Moden wrote:

    @pamkagel ,Do your insert in the following form...

     INSERT INTO dbo.yourtablename WITH (TABLOCK)
    (full column list here)
    SELECT full...

    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

    Btw, how then do you exec the code the function created?  Wouldn't you some type of loop / cursor to do that anyway?

    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

    I admit that I prefer using a cursor here to make it easier to adjust and customize the code.  As the OP stated, there will be special requirements for some...

    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: comma issues in sql statement

    Jeff Moden wrote:

    ScottPletcher wrote:

    The standard pattern uses 0 as the base, not 1 or -1 or some other "cute" trick.

    No sir... There are a couple of "standards".  The "standard"...

    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 Transforming TSQL to MSSQL

    Jeff Moden wrote:

    Jonathan AC Roberts wrote:

    Are you terminating the preceding statement with a semicolon?

    You can start statements that begin with "WITH" with a semicolon:

    ;WITH ret AS(

    Now, there's an interview question...

    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

    The ORDER referred to is when using BULK INSERT, for example loading a physical file into a table.

    In those cases, adding "WITH ( ORDER(clus_key1, clus_key2) )" can allow SQL 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".

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