Forum Replies Created

Viewing 15 posts - 3,301 through 3,315 (of 7,619 total)

  • RE: Is null performance issues

    Do you actually have NULL employee ids?  That's rather bizarre.

    If you do, use Thom's code.  If not, all you need to write is:
    where employee.cgId = @employeeid

    If...

    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: Getting two different fields from two different tables

    Thom A - Tuesday, July 3, 2018 2:01 AM

    ScottPletcher - Monday, July 2, 2018 1:51 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: SELECT WHERE produces strange results....

    Lynn Pettis - Monday, July 2, 2018 5:20 PM

    ScottPletcher - Monday, July 2, 2018 5:01 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: SELECT WHERE produces strange results....

    Lynn Pettis - Monday, July 2, 2018 4:21 PM

    ScottPletcher - Monday, July 2, 2018 4:11 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: SELECT WHERE produces strange results....

    drew.allen - Monday, July 2, 2018 3:12 PM

    stephen.aa - Monday, July 2, 2018 3:02 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: SELECT WHERE produces strange results....

    You don't state what issue happens when you add the WHERE.  [You don't need the N' and shouldn't use it.]

    Perhaps there's some other character in the column besides...

    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: Is null performance issues

    We could give a more specific answer if you'd show the actual code.
    But, for example, if it's something like this:

    WHERE ISNULL(date_column, '19000101') >= '20170101'
    then you don't...

    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: Getting two different fields from two different tables


    INSERT INTO dbo.Tbl3 ( ID1, ID2 )
    SELECT (SELECT ID1 FROM dbo.Tbl1 WHERE Name1 = @Name1),
        (SELECT ID2 FROM dbo.Tbl2 WHERE Name2 = @Name2)

    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 count col1 and col2 as One, where col1 is not duplicate and col2 = fail


    SELECT Total_Input, Total_OK, Total_Fail,
         CASE WHEN Total_Fail > 0 AND Total_Fail > Total_OK THEN Total_OK
         WHEN Total_Fail > 0 THEN Total_Fail
       ...

    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: Index scan operator


    SELECT b.time * 1.0 credit, 0.0 credits, b.Id, b.date
    FROM staff b
    INNER JOIN (
        SELECT *, isnull(dbo.ConvDate2(e.Startdate),'20111101') AS Startdate_converted
        FROM emp

    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 update a value in WHERE clause for a bunch of SQL views

    aftab97 - Wednesday, June 27, 2018 3:36 PM

    ScottPletcher - Wednesday, June 27, 2018 3:31 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: How to update a value in WHERE clause for a bunch of SQL views

    I would hope that SQL itself would change it to an INNER JOIN when applicable, but it certainly won't hurt to try -- or verify using the query plan that...

    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 update a value in WHERE clause for a bunch of SQL views

    aftab97 - Wednesday, June 27, 2018 1:39 PM

    That's an idea, but the tables are vendor proprietary tables and can't be modified.

    Does that...

    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: Cross Database Permissions: SQL 2005 vs SQL 2016

    Check to see if the db A on each instance allows cross-database ownership chaining:

    SELECT is_db_chaining_on, *
    FROM sys.databases
    WHERE name IN ('A')

    If it's 1, then security...

    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: Index scan operator

    We would have to see the tables definition and the query itself to give you a reliable answer here.

    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,301 through 3,315 (of 7,619 total)