Forum Replies Created

Viewing 15 posts - 2,641 through 2,655 (of 7,619 total)

  • Reply To: how to merge 3 different temp tables data into one

    Insert into dbo.StdActiveTable
    (StudentName ,
    StdId ,
    Stdgrade )

    select std.Name
    ,std.StdID
    ,dp.stdgrade
    from dbo.student std
    join dbo.department dp
    on std.stdid = dp.id
    where (dp.isactive = 1) or
    (dp.isactive = 2 and sdt.isactive =...

    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".

  • Reply To: Script to find Long-running job

    Sure, easy to list only those two columns.  I was just mirroring what your original query had, since I wasn't sure exactly what you needed.

    Personally I'd also make the job...

    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".

  • Reply To: Script to find Long-running job

    You need a few mods to your code, in particular to limit the results to only those with the current msdb session_id.  As a starting point for you, this code...

    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".

  • Reply To: Table with all computed columns -vs- View (Pros-Cons)

    Should this be replaced with a table that has 17 computed columns ?

    Yes, if a computed column would work, then that is what you should use rather than a function.

    Can...

    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".

  • Reply To: last day of the month minus 1 day

    below86 wrote:

    Jeff Moden wrote:

    I guess I don't understand why anyone would write software based on the knowledge of novices.  If it's important for a novice to be able to maintain something...

    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".

  • Reply To: last day of the month minus 1 day

    Nothing to do with full-blown "novices".  I would expect people with reasonable experience in SQL Server to know what 0 is, it's the default "base date" in SQL Server.  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".

  • Reply To: Non-technical question

    MVDBA (Mike Vessey) wrote:

    Grant Fritchey wrote:

    Don't, don't, don't dismiss development and say "NO!" to developers.

    I learnt this from a wise old network manager who told me that you catch more flies with honey...

    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".

  • Reply To: Non-technical question

    Along with the excellent suggestions above, also look very carefully at the query plans to see if you're hitting a "tipping point" query.  That is, one query that returns, 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".

  • Reply To: last day of the month minus 1 day

    There's at least one other thread besides this one where someone used it and got the wrong date, because they added a month after the calc with -1 in it.  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".

  • Reply To: last day of the month minus 1 day

    People often learn via patterns.

    If I see a pattern like "DATEADD(<time_period>, DATEDIFF(..." in consistent code, I know already what the result of the main computation will be.  I don't have...

    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".

  • Reply To: last day of the month minus 1 day

    The standard pattern for getting the first day of the month is:

    SELECT DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)

    Stick to that pattern, don't corrupt it with -1 tricks!  That just makes it 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".

  • Reply To: Insert with trigger works with cursor, not set

    Jeff Moden wrote:

    ScottPletcher wrote:

    Or re-create the index so that it allows multiple NULLs but no other dups.

    Apparently, the morning coffee hasn't kicked in for me yet today... what would the CREATE...

    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".

  • Reply To: Insert with trigger works with cursor, not set

    Or re-create the index so that it allows multiple NULLs but no other dups.

    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".

  • Reply To: seeking for tsql help

    Jonathan AC Roberts wrote:

    select s.c1,s.c2,s.c3,  COUNT(*)*IIF(m.c1 IS NULL,0,1) cnt
    from stg_tbl s
    left join main_tbl m
    on...

    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".

  • Reply To: Best Practice to Query SQL Server from Another SQL Server

    But my god MSDTC can play havoc with you when you do remote updates.

    Yes, quite true.  Thus, when you can, with relatively low amounts of data, don't do remote updates. ...

    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 - 2,641 through 2,655 (of 7,619 total)