Forum Replies Created

Viewing 15 posts - 4,636 through 4,650 (of 7,619 total)

  • RE: Query Performance Problem

    Sergiy (11/19/2015)


    ScottPletcher (11/19/2015)


    When one campaign is over all the relevant promo codes are made inactive.

    Yes, by deleting them from the current promo table, not by just flagging them. They...

    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: Unique index on varchar(max) column

    To have the index automatically built, you can add a persisted, computed column, like this:

    CREATE TABLE search_T

    (

    num INT,

    value VARCHAR(max),

    value_for_indexing as cast(left(value,896) as varchar(896)) persisted

    ,UNIQUE CLUSTERED (num,value_for_indexing)

    )

    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: Query Performance Problem

    Sergiy (11/19/2015)


    ScottPletcher (11/19/2015)


    Try to follow this, it's simple enough even for you.

    When it's used up initially, it's removed forever from the current table, since it has no current value.

    No person...

    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: Query Performance Problem

    Sergiy (11/19/2015)


    ScottPletcher (11/19/2015)


    Sergiy (11/19/2015)

    ScottPletcher (11/18/2015)


    Once they've been used up, you'd remove them so they can't be reused.

    How exactly you intend to prevent used codes from being reused (regenerated as new)...

    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: Query Performance Problem

    Sergiy (11/19/2015)

    ScottPletcher (11/18/2015)


    Once they've been used up, you'd remove them so they can't be reused.

    How exactly you intend to prevent used codes from being reused (regenerated as new) if they...

    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: Query Performance Problem

    Sergiy (11/18/2015)


    ScottPletcher (11/18/2015)


    Once they've been used up, you'd remove them so they can't be reused.

    How exactly you intend to prevent used codes from being reused (regenerated as new) if they...

    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: Query Performance Problem

    Sergiy (11/18/2015)


    ScottPletcher (11/18/2015)


    Lol. So you think Amazon.com has every gift code number they've ever issued in their current gift codes table? Unbelievable.

    Why not?

    May be not "ever issued", may...

    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: Query Performance Problem

    Sergiy (11/18/2015)


    ScottPletcher (11/18/2015)


    Of course. But that doesn't mean I have to store decades worth of obsolete numbers in my main table, now does it? If the number is...

    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: Query Performance Problem

    Sergiy (11/18/2015)


    ScottPletcher (11/18/2015)


    First, how do you know that inactive codes are routinely searched? That's almost never the case.

    Mobile top up numbers. Gift cards. iTunes cards. Game access codes. Software...

    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: Read 1st line of a file in t-sql

    I suggest trying the BULK INSERT command, since you can stop it after only one row. Specify a never-found field terminator to make sure you read the entire first...

    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 take the output of the command to a table (specially first two columns) to get logical name and physical name?

    I would think first create a temp table that matches the output of that command:

    CREATE TABLE #filelistonly ( ... )

    then do this:

    INSERT INTO #filelistonly

    EXEC('restore filelistonly from disk = ''G:\folder1\backupfile091.bak'')

    Finally, of...

    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: Query Performance Problem

    Sergiy (11/17/2015)


    ScottPletcher (11/17/2015)


    You can retain the rows in a different table. Use a partitioned view if that works better, with the appropriate CHECK constraints on IsActive in 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: Unable to print the charindex of a special character of its 4th occurrence.

    SQL-DBA-01 (11/17/2015)


    What's wrong in this query?

    SELECT CHARINDEX('_', name) FirstIndexOf,

    --CHARINDEX('_', name)+1,

    CHARINDEX('_', name, (CHARINDEX('_', name)+1)) SecondIndexOf,

    charindex('_',name, CHARINDEX('_',name,(charindex('_',name ) + 1 )) + 1 ) ThirdIndexOf,

    charindex('_',name,CHARINDEX('_',name,(charindex('_', name ,(charindex('_',name ) + 1 )) +...

    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: Date Difference

    First you'll need to decide how you want to handle birthdays on Feb 29. In non-leap years, do you want to treat Feb 28 as the birthday, or March...

    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: select string between two ',' symbols

    insert into #test values

    ('2100110'),

    ('2100110,12')

    select

    HID,

    case when last_comma = 0 then HID

    when next_to_last_comma = 0 then LEFT(HID, LEN(HID) - last_comma)

    else...

    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,636 through 4,650 (of 7,619 total)