Forum Replies Created

Viewing 15 posts - 3,976 through 3,990 (of 7,613 total)

  • RE: DBCC CheckTable -- Help Please?

    I wouldn't worry about a one-time occurrence (although you should review whether or not you are on the latest SP/patch for that SQL instance).

    If it happens again, then...

    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: DBCC CheckTable -- Help Please?

    Oops, sorry, I should have included that part.

    SELECT *
    FROM sys.indexes
    WHERE index_id = 47
    AND object_id = OBJECT_ID('_ACTIVITY_GEN')

    Great, though, that it was index #47, that...

    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: DBCC CheckTable -- Help Please?

    Identity the rows can be extremely difficult.

    First check to see if it's a nonclus or clus index/heap.  If the errors are in a nonclus index, simply drop and...

    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: Age as of January 1st

    dale_berta - Thursday, February 2, 2017 6:47 AM

    dale_berta - Tuesday, January 31, 2017 5:43 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: Sort order guaranteed?

    What you would need to do is this:

    SELECT Description
    FROM (
        SELECT Description, MIN(TransactionDate) AS TransactionDate
        FROM MyTable
        GROUP BY...

    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: Any ideas on bad query plan?

    Absolutely get rid of the LTRIM and RTRIM.  Also, review all indexes on the tables, particularly making sure that you have the best clustered index on every (significant)...

    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: Getting morning, afternoon and evening matches from a set of dates by day of week

    A couple of things here:

    1) The hours ranges given exclude times and allow times to overlap, which is almost certainly not what you really want.
    2) Let's go...

    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: Age as of January 1st

    All you need is year, since any birthday during the @service year won't count anyway:

    DECLARE @Birth DATETIME = '11/30/1951'
     ,@Service DATETIME = '2016-08-26'

    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: Convert number to certain value from table

    Eirikur Eiriksson - Thursday, January 26, 2017 12:21 PM

    Joe Torre - Thursday, January 26, 2017 12:11 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: Convert number to certain value from table

    I wouldn't limit the values to single chars or require each value to be the next letter in the alphabet.  Instead, for example:

    INSERT INTO #tbl_value(Code,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: Partioning a table according to a certain WHERE clause

    SELECT customerID
    FROM table_name
    GROUP BY customerID
    HAVING MAX(CASE WHEN RowID = 1 and CustomerCode = 'P' THEN 1 ELSE 0 END) = 1 AND
      MAX(CASE WHEN RowID =...

    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: Comma separated list

    Sergiy - Wednesday, January 25, 2017 3:32 PM

    Try not to use DISTINCT.
    Ever.
    Just forget this keyword exists 

    What a bizarre claim.  DISTINCT is more...

    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: Checking for NOT NULL condition

    You must use "IS NOT NULL" rather than just "NOT NULL":

    if @sen like 'BY%' and @fdd IS NOT NULL
    ...

    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 check for the existence of a column in a temporary table if the name of the table exists more than once in tempdb

    jshahan - Monday, January 23, 2017 2:03 PM

    drew.allen - Monday, January 23, 2017 2:00 PM

    Why are...

    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 get hardcoded date form table

    Also, to reduce errors and potential errors, don't code dates in an ambiguous format, i.e.,
    does '11/6/2010' represent Nov 6 or Jun 11??
    or waste space with formatting chars....

    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,976 through 3,990 (of 7,613 total)