Forum Replies Created

Viewing 15 posts - 3,061 through 3,075 (of 7,619 total)

  • RE: Need help


    SELECT tn.*
    FROM dbo.table_name tn
    INNER JOIN (
        SELECT client_id,PU
        FROM dbo.table_name
        GROUP BY client_id,PU
        HAVING MIN(Due_time) <> MAX(Due_time)

    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: Inner joins

    drew.allen - Wednesday, November 21, 2018 11:33 AM

    Jeff Moden - Wednesday, November 21, 2018 9:06 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: Obfuscating character columns

    If you're on SQL 2016, you should use SQL's native data masking capability.  It will easily and efficiently do exactly what you want.

    If that won't work, you could...

    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 and Search help

    Jonathan AC Roberts - Wednesday, November 21, 2018 8:32 AM

    ScottPletcher - Monday, November 19, 2018 12:53 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: Index and Search help

    (1) Get rid of the ActiveStatus column.  It's useless, and it can cause headaches for the optimizer.  That type of column really is a throwback to tape-based data.

    (2) At...

    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: Reindexing and Log files

    No, it's not necessarily a good idea.  In fact, stop it first, then see what's it doing.  If it's using generic rules, like 10% and 30%, then don't restart the...

    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: Inner joins

    MS will probably get rid of the old-style joins at some point, but it will likely be a long while, since INNER joins cannot be misinterpreted in the WHERE clause...

    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: IsNull to check column

    It can be done using ISNULL().  I'm not trying to say that's necessarily better, just that it can be done, assuming col1 <> col2:


    SELECT ISNULL(NULLIF(ISNULL(col1,...

    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 find the lowest usage of a database

    Jeff Moden - Wednesday, November 14, 2018 10:45 PM

    WhiteLotus - Wednesday, November 14, 2018 8:49 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 only one register with condition

    Use "TOP (1)" to limit the results to one row.  For example:


    SELECT TOP (1) Field 
    FROM TABLE 
    ORDER BY Field

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

    For the time, I'd so a single DATEADD with only SECONDs being added, something like this:


    DECLARE @order_time float
    SET @order_time = 11456

    SELECT CAST(DATEADD(SECOND,...

    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: Optimize a LIKE '%text%' query

    Create a nonclustered index using the clustering column(s) as key(s) and INCLUDE the search column.  That's about the best you can do with this type of requirement.

    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: Placing data file , log file and temp file in 1 drive or separate drive ?

    The data and log files for any given db must always be on separate drives.  That is, that a single physical drive failure cannot destroy both data and log files...

    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: Caution about Restoring via SSMS v17

    Steve Jones - SSC Editor - Tuesday, November 6, 2018 12:02 PM

    They absolutely do. And most people never have an accurate...

    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: Caution about Restoring via SSMS v17

    Interesting ... do DBAs really use the gui to do backups and restores?  I never have.  For one reason, then I have no accurate record of what was done.

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