Forum Replies Created

Viewing 15 posts - 5,491 through 5,505 (of 7,619 total)

  • RE: Can any one help me to optimize this query? Thanks.

    SELECT

    DD1.[Incident_x0020_Date] AS [Incident Date],

    1 AS [Order],

    DD1.[Int_x002f_Dom] AS [Location],

    DD1.[ACTION] AS [Action],

    DD1.[Channel] AS [Channel Type],

    SUM(CASE WHEN DD1.[DLP_x0020_VIOLATION] = 'Bribery & Corruption' 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: Inserting FK information into a temp table

    Note that you can also create non-temp tables in the tempdb database. That way the table will be there even if the connection that created it "gets broken" or...

    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: dbcc dbcc show_Statistics question

    The index is empty, i.e., there are no rows in that 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: Get closest int

    SELECT sm.*, tv_lookup.Amount AS tv_Amount, tv_lookup.PercRate AS tv_PercRate, tv_lookup.Code AS tv_Code

    FROM #SM sm

    OUTER APPLY (

    SELECT TOP (1) *

    FROM #TestValues tv

    ...

    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 answer interview question "what is the hardest sproc you have created?"

    Jeff Moden (1/8/2015)


    Now, based on what I just said, one of my first questions on an SQL Server technical interview for DBAs and Developers alike is "How do you get...

    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: Comparing Bits and Ints

    I'm almost certain the optimizer is sophisticated enough to implicitly convert the literal value rather than a variable value or a column.

    If you're still concerned about it, you could do...

    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: Locking issues

    If you primarily use columns "Company" and "Form_Name" to do lookups and/or joins on table "COLUMN_NEXT_ID_RECENT_ITEMS", make sure the table is clustered on those columns. [It might, instead, 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".

  • RE: Query

    If the query otherwise works the way you want it to, just remove the unneeded column from the subquery:

    ...,

    (SELECT C1.containerCode as containerCode --,SE.createdOn

    FROM Containers C1

    LEFT JOIN StoringsEvents SE ON C1.containerIncId...

    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: Calendar Table Function

    I don't like the extra overhead of generating hundreds of rows every time when you only need a dozen or two.

    A "standard" sequential-numbers tally table can easily handle those types...

    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 hide/disable the menus New Database, Restore Database in SQL Server Management Studio

    Grant Fritchey (1/6/2015)One other point, I'm not sure what industry you're working in, but many, especially healthcare, now have criminal penalties if you expose personal data to people without permission...

    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: Pattern matching (positive across records, negative within a field)

    First thought for first task:

    Compare one customer's pattern to the concatenated pattern of another customer(s). This should alleviate the off-by-n issue. Naturally you could also reduce the repeating...

    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 rewrite query to avoid duplicate records (across columns)

    Eirikur Eiriksson (1/6/2015)


    ScottPletcher (1/6/2015)


    Eirikur Eiriksson (1/6/2015)


    ScottPletcher (1/6/2015)


    Jeff Moden (1/4/2015)


    asita (1/3/2015)


    Nolock is ignore the locks (please ignore it)

    Trust me Dhani, we know what it does and folks in-the-know can't just ignore...

    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: Split Columns of Months into Columns of Weeks

    Great, glad it helped. It was a fun exercise :). And thanks so much for posting the final solution so I could see it! Yeah, I thought...

    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: Change From Single Variable to Table Variable

    DECLARE @CopyParams TABLE (

    CopyFromVIEGuid uniqueidentifier,

    CopyToVIEGuid uniqueidentifier

    )

    UPDATE [dbo].XdsInboundSecurity

    SET ClientCertificateThumbprint = (

    Select...

    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: Cannot find the executing stored procedure

    Keep in mind that a proc exists in that view as long as it is still in the procedure cache. As long as the proc is in the cache,...

    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 - 5,491 through 5,505 (of 7,619 total)