Forum Replies Created

Viewing 15 posts - 3,406 through 3,420 (of 7,613 total)

  • RE: Number of Days between two Day Names

    patrickmcginnis59 10839 - Monday, May 7, 2018 1:59 PM

    jasona.work - Monday, May 7, 2018 1:38 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: Date Upto 28 days ahead, no weekends

    In any contiguous 28-day period, there will always be exactly 20 non-weekend dates and 8 weekend dates.

    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: Number of Days between two Day Names

    jasona.work - Monday, May 7, 2018 12:24 PM

    Throwing in my 2cents on this, after reading through it...
    I'm on Jeff's side for...

    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: TSQL to check database backup status

    You can directly search for "Backup" "failed" messages without having to pull the entire log file first, viz:

    EXEC sys.xp_readerrorlog @ArchiveID, 1, N'Backup', N'failed'

    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: Number of Days between two Day Names

    When you create a weekly job schedule in SQL, you specify "Wednesday", as in every Wednesday (or specified identified Weds of the month), but you do not list all future...

    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 modified records in a table without using timestamp columns ?

    No.  SQL Server itself does not store that type of info.  It would be too much overhead on the system.

    If the table has a unique key, 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: How to find First monday of last month in SQL Help

    I strongly prefer to avoid code that requires a specific DATEFIRST setting; my code works the same under any setting.
    But this:
    WHERE DatePart(dw, d)=2
    adds a dependency on 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: How to find First monday of last month in SQL Help


    SELECT
        passed_date, DATEADD(DAY, -DATEDIFF(DAY, 0, day7) % 7, day7) AS calcd_date
    FROM (
        VALUES(CAST('20180522' AS date)),('20180603'),('20180704')
    ) AS test_data(passed_date)
    CROSS APPLY (
     ...

    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: Number of Days between two Day Names

    Why the need to over-engineer everything?  Each entry is, for example, "Wednesdays" not a specific Wednesday,  Simple enough.  Although I do agree that "Monday", "Monday" in the same row should not...

    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: Help with an upsert

    You're welcome, let me know how it goes.

    Btw, it's inconsistent to use data type "datetime2" and GETDATE(), which returns only a "datetime" value.  That's why I used SYSDATETIME()...

    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: Help with an upsert


    UPDATE pr
    SET fieldvalue = pe.requestind,
        datelstmod = SYSDATETIME()
    FROM process pr
    INNER JOIN person pe ON pe.personid = pr.personid AND pr.activityid = 991
    WHERE...

    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: Max() statement confusing

    This a common technique ("trick") to get a single line of values from multiple lines of input.  It's almost always at least a pair of conditions, e.g.:
    MAX(CASE WHEN rline...

    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: Most efficient way of not selecting data

    sgmunson - Thursday, May 3, 2018 12:00 PM

    george_at_sql - Thursday, May 3, 2018 10:46 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: Number of Days between two Day Names

    Jeff Moden - Thursday, May 3, 2018 11:58 AM

    patrickmcginnis59 10839 - Thursday, May 3, 2018 11:20 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: Number of Days between two Day Names

    To the OP:

    I'd suggest not over-complicating what you have unless/until it's actually needed.  Why spends hours doing something that may never be applicable or useful?  If the conditions change,...

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