Forum Replies Created

Viewing 15 posts - 7,471 through 7,485 (of 7,619 total)

  • RE: Unable to shrink an almost empty ndf file

    Did you deletes of lots of table data in some cases rather than table drops?

    At any rate, just to be sure, I would run sys.dm_db_index_physical_stats () on remaining tables 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: SQL Like Clause

    The setup and maintenance on full-text indexes is not trivial.

    It's not a problem for a full-time DBA, but if you're not a DBA, it can be a tricky thing, especially...

    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 Like Clause

    I wouldn't automatically add a leading %. That forces a full scan which is often unnecessary if the requestor knows what the first name starts with.

    Instead, allow the user...

    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: Trigger Fails to Work

    You should be able to update all rows at once, like so:

    set ANSI_NULLS ON

    set QUOTED_IDENTIFIER ON

    GO

    ALTER TRIGGER [dbo].[tr_TaxID]

    ON [dbo].[Item]

    after INSERT, UPDATE AS

    UPDATE [dbo].[Item]

    SET

    taxid...

    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: sum for for different criteria in one query

    I would just use a CASE statement.

    But you raised a good point I overlooked.

    If you do need only current year's data, I should have added a WHERE clause with a...

    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: sum for for different criteria in one query

    SELECT

    name,

    SUM(CASE WHEN date_column >= CAST(YEAR(GETDATE()) AS char(4)) + '0101'

    THEN total ELSE 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: Running Sql Server Program files on RAID10 - is this necessary for performance ?

    Not 100% sure, don't think it's a lot longer. Neither one is very fast really rebuilding 🙂 .

    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: Running Sql Server Program files on RAID10 - is this necessary for performance ?

    For (almost) pure reads, as O/S and SQL pgms are, RAID5 should be faster than RAID10, with the same number of spindles for each RAID.

    So, I'd say use...

    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 statement

    An UPDATE statement will always cause some type of lock(s) on the table. SQL must do locks to insure the integrity of the UPDATEs.

    Depending on the number of rows...

    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: Making NOT NULL

    If I understand correctly:

    ((COALESCE([prefix]+'-'), '')+right('0000'+COALESCE(convert([varchar],[numeric],(0)), ''),(4)))

    is persisted =yes

    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: Varchar(max) performance problem in SQL server 2008 R2

    For XML data, you are very likely better off specifying XML as the data type rather than varchar(max), since SQL optimizes XML storage.

    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: Order by While inserting

    When did SQL Server start doing these "auto sorts" for clus 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: Order by While inserting

    I wouldn't call it 'auto-magically',

    That's primarily what I meant. I thought it was conditional. I've seen SQL not do it.

    To me it's much safer to code your...

    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: Order by While inserting

    I thought it depended on whether SQL thought it was "necessary" or not.

    Whether the number of rows, etc., met whatever magic criteria SQL went by -- which are not documented...

    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: Order by While inserting

    IIRC, a single insert of many rows will be done in the clustered index order auto-magically.

    Really? Interesting. I don't recall that. Would be nice tho.

    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 - 7,471 through 7,485 (of 7,619 total)