Forum Replies Created

Viewing 15 posts - 3,901 through 3,915 (of 7,619 total)

  • RE: Multiple entity table design help

    You'll need an abstract that represents any legal entity about which you need to store information.  In this case, so far that's company or shareholder.

    Legal_Entities ( Legal_Entity_Id, Name,...

    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: Use dynamic database name in t-sql statement

    Very sorry, sp_marksystemobject is my own version of the true MS proc.

    You should run this:
    USE master
    EXEC sys.sp_MS_marksystemobject 'dbo.sp_your_proc_name_here'

    The point of creating it in master...

    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: Use dynamic database name in t-sql statement

    I recommend you create a procedure in the master db that can automatically run in the context of any db you need.  Below is the code to create the proc....

    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: SQL code for the below

    ROW_NUMBER() is not gonna work prior to SQL 2005 either anyway :-).

    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: Encapsulating complex logic without using a scalar UDF

    patrickmcginnis59 10839 - Thursday, March 16, 2017 9:32 AM

    ScottPletcher - Thursday, March 16, 2017 8:52 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: Update Query Performance

    With thousands of users trying to modify the exact same row, SQL must do them one at a time, pausing the others until those before it complete.  Otherwise, of course,...

    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: Encapsulating complex logic without using a scalar UDF

    Jeff Moden - Wednesday, March 15, 2017 6:21 PM

    The single update on a calendar table to renumber the working day enumerations is...

    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: Covering Index

    A covering index is an index that has all the columns needed to satisfy, or "cover", a given query.

    For example, say I have a table with 20 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: Differences in this where statement

    1) You didn't strip the time.
    2) You need to use < the ending day, rather than <=

    For example:

    I've changed it to:
    (DateAttribute >= DATEADD(DAY,-10,CAST(GETDATE() 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: Clustered scan vs Non-clustered Seek with lookup

    Since you already have an identity column, go ahead and add that to make the clustering unique.  SQL would "uniquify" it, but it's better to do it yourself to avoid...

    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: Clustered scan vs Non-clustered Seek with lookup

    Jeff Moden - Tuesday, March 14, 2017 11:32 AM

    I'd make sure that col1 is immutable, unique, and ever-increasing or there will be...

    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: Encapsulating complex logic without using a scalar UDF

    jcelko212 32090 - Tuesday, March 14, 2017 11:31 AM

    ScottPletcher - Monday, March 13, 2017 11:45 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: Clustered scan vs Non-clustered Seek with lookup

    Change the clustering index to the 2 columns that are used most often / nearly always as predicates.  If you prefer, you can add a unique column as a 3rd...

    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 Correct Index for slow query

    Some things to consider:

    Typically you'll most likely access these rows by datetime range.  I'm guessing the actual query might even have such a date restriction, or, if 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: Encapsulating complex logic without using a scalar UDF

    jcelko212 32090 - Monday, March 13, 2017 11:17 AM

    Jeff Moden - Saturday, March 11, 2017 8:42 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,901 through 3,915 (of 7,619 total)