Forum Replies Created

Viewing 15 posts - 2,941 through 2,955 (of 7,613 total)

  • RE: Age Range From Today's Date

    As in your original method, you don't need to calc everyone's age, just check the correct date range.  Like this:


    WHERE Birthdate >= DATEADD(DAY, 1, DATEADD(YEAR,...

    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: nolock/readuncommitted: PK-Violation due to data movement - explanation of locking behaviour?

    Second process uses read committed, thus uses an S-Lock on all the read records, and releases it when having finished the statement. 

    No.  Actually, in RC level, 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: Index on #tmp without PK

    You can, but you shouldn't.  If you're creating only one index on a temp table, make it a clustered index not a non-clus index; the key columns don't have 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: Optimizing a dynamic sorting SQL query

    Don't sort the query, sort the result table instead, which is more useful anyway.  Even if sort the query, you will still have to sort again when reading from 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: Merge from Heap to Clustered Index Table.... Improvements?

    You should cluster the staging table on the DM_KEY_HASH also, assuming you can compute the hash key as the row is being INSERTed into the staging table.  SQL is having 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: SSIS Can't set foreign keys to NULL in an update

    When you create a FK constraint, you can specify whether the key can be NULL or not.  If the creating code says it can't be set to NULL -- either...

    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: Using Dynamic SQL to create a list

    If @value is a single value -- and it seems like it would have to be only a single value -- then wouldn't it be simpler and more efficient 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: Sort already comma separated list

    patrickmcginnis59 10839 - Monday, February 18, 2019 1:32 PM

    jcelko212 32090 - Monday, February 18, 2019 1:15 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: Sort already comma separated list

    Jonathan AC Roberts - Monday, February 18, 2019 10:22 AM

    patrickmcginnis59 10839 - Monday, February 18, 2019 10:04...

    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: Sort already comma separated list

    patrickmcginnis59 10839 - Monday, February 18, 2019 7:16 AM

    I'd just like to thank Joe for fighting the good fight. I'm seeing HORRIFIC...

    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: Invalid use of a side-effecting operator 'rand' within a function

    Pass the RAND value in.  And, for efficiency, get rid of the local variables in the function.

    SET ANSI_NULLS ON;
    SET QUOTED_IDENTIFIER ON;
    GO

    CREATE function...

    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: Sort already comma separated list

    jcelko212 32090 - Friday, February 15, 2019 2:56 PM

    ScottPletcher - Friday, February 8, 2019 2:44 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: Capitalising the contents of a field

    You might want to test for lower case chars before doing the UPDATE, using any case-sensitive collation:


    UPDATE CONTACT
    SET COUNTRY = UPPER(COUNTRY)
    WHERE COUNTRY...

    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 many exec plans SQL Server keeps for the same stored proc?

    You can also get that if you don't include the schema name when referencing tables.  For example:

    SELECT ...
    FROM table1

    SQL will often generate a separate plan...

    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: Find and replace third occurrence of the string

    ben.brugman - Thursday, February 14, 2019 2:32 AM

    ScottPletcher - Monday, February 11, 2019 1:03 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 - 2,941 through 2,955 (of 7,613 total)