Forum Replies Created

Viewing 15 posts - 3,031 through 3,045 (of 7,613 total)

  • RE: Error: Cannot insert duplicate key row in... a non-unique index?!

    None of those indexes match the name in the error message.

    What is the DDL for index 

    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: Subquery - another way to achieve the same result?


    select v1.amount,
        sum(case when v1.ConfirmedAt is null then 1 else 0 end) as ConfirmNullCount,
        sum(case when datediff(day,v1.confirmedat,getdate())<365 then 1 else 0 end)...

    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: COALESCE Issues when controlling logic in a tvf

    Extremely vague.  But in general, rather than actually SELECTing the data, using EXISTS() to check for it is more efficient.

    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 can I combine the three queries to one and possibly improve performance

    If you wanted to always keep the original temp table, that's fine.  I don't have a problem at all with that.

    But write the q that way then

    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: Interesting Use Case Of CEILING

    Float values are not exact, they are approximate.  Internally, float 0.55 might be 0.550000000001.  CEILING goes up to the next int value no matter how small the amount above the previous...

    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 can I combine the three queries to one and possibly improve performance

    I'm genuinely confused.

    Your q states"How can I combine the three queries to one".  We write queries that combine the 3 queries into a single query. 

    But then...

    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: Where did our 30GBs go?

    scarr030 - Tuesday, December 11, 2018 10:49 AM

    ScottPletcher - Tuesday, December 11, 2018 10:27 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: How can I combine the three queries to one and possibly improve performance

    It could be more efficient to get only typeid from table1 in the first pass, like below.  This depends on indexing and the cardinality (how many t1 rows have typeids...

    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: Where did our 30GBs go?

    scarr030 - Tuesday, December 11, 2018 6:08 AM

    Jonathan AC Roberts - Monday, December 10, 2018 7:22 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: Advice on purging data

    aquanut - Monday, December 10, 2018 12:42 PM

    Hi Scott,

    I'd be concerned with staying within the maintenance window - steps 1 through...

    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: Advice on purging data

    Since you're only keeping ~1/6 of the data, you may want to consider a different approach.

    Backup up everything (of course!).  You might even want to make another copy...

    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 extract e specific data from a table

    Eirikur Eiriksson - Saturday, December 8, 2018 4:12 AM

    ScottPletcher - Friday, December 7, 2018 10:57 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: how to extract e specific data from a table


    SELECT [Product Line]
    FROM dbo.[Table]
    GROUP BY [Product Line]
    HAVING MAX(CASE WHEN [Business Unit] = '' THEN 1 ELSE 0 END) = 1 AND
        MAX(CASE...

    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: Clustered Index Scan vs Seek

    If there is any (non-filtered) index keyed first on id, then MAX(id) will do an index seek/lookup.  Internally it could officially be a scan, but it will be a scan...

    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: Trying ot understand how permission works when schedule a job through SQL Agent

    If the job owner has 'sa' level permissions, then the job is run under the Agent's service account, and thus using its permissions to other resources -- drives, network, etc..

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