Forum Replies Created

Viewing 15 posts - 6,811 through 6,825 (of 7,613 total)

  • RE: IF or CASE on 2 different columns, THEN values x, y or z

    am wondering if the CASE requires all arguments to run against the exact same column?

    No. CASE is very flexible: you can compare any columns you need to, in any...

    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: Last Sunday of a month in sql

    ScottPletcher (2/11/2013)


    Michael Valentine Jones (2/11/2013)


    ScottPletcher (2/11/2013)


    Method below works for any and all date and language settings:

    DECLARE @startDate datetime

    DECLARE @number_of_months int

    SET @startDate = GETDATE()

    SET @number_of_months = 7

    SELECT

    DATEADD(DAY,...

    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: Last Sunday of a month in sql

    [superceded by next post]

    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: missing index already exists

    Marius.D (2/11/2013)


    Scott:

    or maybe you specified DESC on one of the existing index keys?!

    I did not, but would that make a difference? I didn't think the missing indexes...

    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: Last Sunday of a month in sql

    Method below works for any and all date and language settings:

    DECLARE @startDate datetime

    DECLARE @number_of_months int

    SET @startDate = GETDATE()

    SET @number_of_months = 7

    SELECT

    DATEADD(DAY, DATEDIFF(DAY, '19000107', last_day_of_month) / 7...

    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: missing index already exists

    Hmm, that still doesn't make sense.

    Compare them very closely: there must be some difference somewhere ... or maybe you specified DESC on one of the existing index keys?!

    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: Decimal vs Numeric

    In SQL Server, there is no difference.

    I guess the backward compatability would be that you can still use "numeric" rather than the offical "decimal".

    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: Database Design Help

    Yeah, reasonably close.

    Probably the major difference is that the OP and myself don't want to "flatten" the Chain and Store into a single "location".

    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: Performance Issue - understanding query plans

    nick.mcdermaid (2/7/2013)


    Thanks for your advice Scott.

    I did change the PK to

    RowNum_Start,SRC_System, SRC_Application

    and also

    SRC_System, SRC_Application,RowNum_Start

    (Yes I know you can create a clustered index that isn't based on the primary key)

    In both...

    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: Split Sql Server Index Rebuild job into several parts - Divide load of Rebuild Index job

    You could move the BLOB(s) to a different table; use views if you need to, to combine the original table columns and the BLOB(s), to keep current apps "happy".

    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: Split Sql Server Index Rebuild job into several parts - Divide load of Rebuild Index job

    So are you doing a REORG or a REBUILD?

    Is it on Enterprise Edition (2008)?

    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: Database Design Help

    You need to keep this normalized and have a separate table for every relation. You could even create an additional table to control the chain/store incidents if needed.

    Here's some...

    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: Split Sql Server Index Rebuild job into several parts - Divide load of Rebuild Index job

    You could partition the table; if you're lucky, the older data will not even need rebuiilt, and you can greatly reduce rebuild time and overhead.

    Even if it all still needs...

    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: My first UDF doesn't work. Thoughts?

    I strongly recommend fully qualifying all table names with the owning schema, typically "dbo" but of course could be different in your specific environment.

    For example:

    ...

    from dbo.AbstractData a

    inner join dbo.AbsDrgDiagnoses b...

    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: Question about the BulkAdmin

    Granting bulkadmin doesn't actually give that person INSERT authority to any table.

    Any user would still need standard GRANT INSERT on a table or a role containing that authority to insert...

    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 - 6,811 through 6,825 (of 7,613 total)