Forum Replies Created

Viewing 15 posts - 4,996 through 5,010 (of 7,613 total)

  • RE: Self Join alternative

    Yeah, you could do that, but it's rather bizarre. What would the day before's activities have to do with today?

    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 validate a trigger in SQL Server

    Again, check this DMV:

    sys.sql_expression_dependencies

    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 validate a trigger in SQL Server

    A table that doesn't exist is a different issue, because SQL's deferred name resolution allows that, but not invalid/missing column names.

    The other thing to try would be dmv:

    sys.sql_expression_dependencies

    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: Self Join alternative

    Here's a quick cross-tab example specific to your situation:

    SELECT D.PersonID,

    MAX(CASE WHEN D.Activity = 'Woke Up' THEN D.ActivityTime END) AS WakeUpTime,

    MAX(CASE WHEN D.Activity...

    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 make sproc return errors for underlying table errors

    You didn't get an error because a bit column will treat any value greater than 1 as 1, so SQL converted the "2" to a 1.

    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 validate a trigger in SQL Server

    Try running:

    sp_refreshsqlmodule or

    sp_refreshview

    on potentially affected objects.

    You should get errors on the object(s) that now reference unknown columns.

    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 make actual execution plan better?

    Jeff Moden (6/30/2015)


    GilaMonster (6/30/2015)


    Jeff Moden (6/30/2015)


    It seems like a lot of folks don't understand that a non-clustered index is a duplication of data that not only affects queries and space...

    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: free tempdb

    You can add a file to tempdb if you need to. Or explicitly expand an existing file(s) yourself.

    Be extremely careful if/when trying to modify, or drop, existing objects in...

    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: need help on Scalar value Function

    Sean Lange (6/30/2015)


    Jacob Wilkins (6/30/2015)


    This is all rather interesting, so I thought I'd chime in.

    Based on what I've tested, Scott is technically correct. Under the right conditions, even where it...

    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: Query help - pulling daily total from cumulative total

    You'll probably need to use ROW_NUMBER() for now:

    ;WITH CTE_sales AS (

    SELECT

    date_created, sales,

    ...

    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: need help on Scalar value Function

    Jeff Moden (6/26/2015)


    ScottPletcher (6/26/2015)


    Sean Lange (6/26/2015)


    ScottPletcher (6/25/2015)


    GilaMonster (6/25/2015)


    Nolock hints, do you know what they do? (hint, they don't make queries faster)

    Why does everyone keep repeating that?

    Scott you have been...

    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: need help on Scalar value Function

    Sean Lange (6/26/2015)


    ScottPletcher (6/25/2015)


    GilaMonster (6/25/2015)


    Nolock hints, do you know what they do? (hint, they don't make queries faster)

    Why does everyone keep repeating that?

    Scott you have been around sql long...

    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: need help on Scalar value Function

    Jeff Moden (6/25/2015)


    ScottPletcher (6/25/2015)


    sgmunson (6/25/2015)


    ScottPletcher (6/25/2015)


    GilaMonster (6/25/2015)


    Nolock hints, do you know what they do? (hint, they don't make queries faster)

    Why does everyone keep repeating that? Of course NOLOCK hints...

    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: need help on Scalar value Function

    sgmunson (6/25/2015)


    ScottPletcher (6/25/2015)


    GilaMonster (6/25/2015)


    Nolock hints, do you know what they do? (hint, they don't make queries faster)

    Why does everyone keep repeating that? Of course NOLOCK hints make queries run...

    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: query about nulls

    sgmunson (6/25/2015)


    ScottPletcher (6/25/2015)


    I prefer this approach [Edit: Because of its clarity, and to avoid using functions in the WHERE clause, which should be avoided whenever (reasonably) possible]:

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

Viewing 15 posts - 4,996 through 5,010 (of 7,613 total)