Forum Replies Created

Viewing 15 posts - 4,486 through 4,500 (of 7,619 total)

  • RE: Date Function

    I think this will do the same thing, much more simply and clearly:

    Declare @StartDate DATETIME,

    @EndDate DATETIME

    if DAY(@StartDate) >= 7

    set @StartDate = DATEADD(day, -15, DATEADD(DAY, DATEDIFF(DAY, 0,...

    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: Memory pressure and unable to obtain locks during Bulk Inserts

    For a BULK INSERT, you'd typically want to take a table lock anyway, to allow minimal logging (edit: and reducing locking and logging overhead as much as possible) . ...

    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: Reorg index, rebuild index and reorg table

    Hugo Kornelis (1/13/2016)


    ScottPletcher (1/13/2016)


    Slapping an identity on the table isn't particularly damaging in and of itself.

    It actually is. If not needed, it is a waste of storage both on disk,...

    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: limitation on number of tables joined

    No, I wouldn't worry about indexing/clustering for the other result sets if they are created as part of the main query.

    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: Row Number in SQL Server - need certain rows only

    Isn't this q just a duplicate of http://www.sqlservercentral.com/Forums/Topic1752199-3077-1.aspx

    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: Is it possible to set fill-factor on partition level?

    As noted, you could compress the earlier partitions and not the current ones.

    Also, carefully review the fillfactor and make sure it really should be as low as 80%. That's...

    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: limitation on number of tables joined

    For only 50 rows from each, you'll very likely be OK regardless. Still, before loading the intermediate tables, cluster them on the join key(s).

    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 identify duplicate data with out Primary Key

    Is the "base length" of the columns at least the same? That is, when you say the value is the same except chars are added, is the initial value...

    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: Reorg index, rebuild index and reorg table

    Hugo Kornelis (1/13/2016)


    ScottPletcher (1/13/2016)


    In particular, don't just slap an identity on the table and assume that's automatically the best clustering key.

    Fixed that for you. 😉

    Not at all :-D. Slapping...

    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: Reorg index, rebuild index and reorg table

    Jeff Moden (1/12/2016)


    ScottPletcher (1/12/2016)


    never use a default clustered index on a table

    I've got to say that I totally disagree with that. The clustered index is frequently used 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".

  • RE: "current" errorlog size

    SELECT CAST(size / 128.0 AS decimal(9, 2)) AS size_mb

    FROM sys.database_files

    WHERE type = 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: Seperate Date and Week

    ;WITH cte_days AS (

    Select 1 AS day#, 'Mon' AS day UNION ALL

    Select 2, 'Tue' UNION ALL

    Select 3, 'Wed'...

    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: Reorg index, rebuild index and reorg table

    Steve Jones - SSC Editor (1/12/2016)


    I'll grant you that if there are no non-clustered indexes, this isn't a problem, but you have other problems if you have no indexes 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".

  • RE: Dynamic SQL and Parameters

    If you need a procedure to run in the context of multiple databases, create it in the master db, start the proc name with "sp_", and, after you create 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: Reorg index, rebuild index and reorg table

    Steve Jones - SSC Editor (1/11/2016)


    Alexander Suprun (1/11/2016)


    You can easily rebuild a heap table starting from SQL Server 2008.

    ALTER TABLE [TableName] REBUILD

    This is bad. Don't do it.

    http://www.sqlskills.com/blogs/paul/a-sql-server-dba-myth-a-day-2930-fixing-heap-fragmentation/

    It's not necessarily bad....

    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,486 through 4,500 (of 7,619 total)