Forum Replies Created

Viewing 15 posts - 3,166 through 3,180 (of 7,613 total)

  • RE: Is there a better way to write a simple query?

    100% not using a JOIN clause screams "noob".

    But I see many more issues.

    A serious one is not including a schema name before the table names. ...

    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 there a better way to write a simple query?

    sgmunson - Monday, September 17, 2018 1:40 PM

    thelenj - Monday, September 17, 2018 1:21 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: Multiple Join Behaviour

    drew.allen - Monday, September 17, 2018 11:50 AM

    RonKyle - Friday, September 14, 2018 1:04 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 do I write a record for each day in a date range???

    Eirikur Eiriksson - Monday, September 17, 2018 3:13 AM

    The quickest I've found (so far) is to subtract the day of month...

    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: Stored Procedure using WITH

    Remove the comma from the last column name before the FROM:
    ...
    hd--, --<--remove this comma
    ...
    from icr_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: Does a check constraint with UDF has performance impact on Query?

    You do need a separate codes table to do what you want.  But that table could be fully maintained automatically by triggers on the "master table".  That is, you wouldn'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: Dynamic creating indexes

    My preference has been to store the original sys.indexes and sys.index_columns rows rather than storing what you generated from them.  You can always generate it later if you need to,...

    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: Delete Old Tables

    Jeff Moden - Monday, September 10, 2018 8:04 AM

    unas_sasing - Thursday, September 6, 2018 9: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: Selecting Min of multiple values, including an operation

    Not 100% sure of the specific MIN rules, but something like this should do it, and far more efficiently:


    SELECT DISTINCT

    ire.SourceId as...

    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: Report runs faster after Backup and Restore

    Long shot, but I suppose it's possible that the original db was very physically fragmented on disk and the restore made the disk contiguous.  Very rare nowadays, esp. with modern...

    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: Profiling spikes in query duration

    Look into log space allocations.  You can trace them in different ways, including extended events. 

    When a log file is extended, activities in the db must cease while...

    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: Blocking in a VL Table

    How is the table clustered?  If you query the table by date, cluster it by date.  Then you won't have any issues reading historical data, and you could safely use...

    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: DATALENGTH and LEN difference between NUMERIC(16,6) and NUMERIC(18,2)

    Sergiy - Wednesday, September 5, 2018 5:48 PM

    It really does seem to be some efficiency mechanism in SQL to not use more...

    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: DATALENGTH and LEN difference between NUMERIC(16,6) and NUMERIC(18,2)

    It really does seem to be some efficiency mechanism in SQL to not use more than 5 bytes unless it's actually needed to store the specific value being saved.

    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: When is too many columns too many columns?

    ZZartin - Wednesday, September 5, 2018 1:52 PM

    Jonathan AC Roberts - Wednesday, September 5, 2018 12: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".

Viewing 15 posts - 3,166 through 3,180 (of 7,613 total)