Forum Replies Created

Viewing 15 posts - 1,831 through 1,845 (of 6,036 total)

  • RE: Query Performance Problem

    ScottPletcher (11/17/2015)


    You can retain the rows in a different table. Use a partitioned view if that works better, with the appropriate CHECK constraints on IsActive in each table of...

  • RE: Storing user relations with conditional join on other tables

    "Single row" is not a good representation of a partnership/relation.

    First, as you realised, it's not symmetrical, partners are not equal in it by design.

    Second, it does not allow more then...

  • RE: Query Performance Problem

    ScottPletcher (11/16/2015)


    But there is still no reason whatsoever to cluster this table by identity.

    Actually, there is.

    And I pointed on it in my previous post:

    to preserve random...

  • RE: Query Performance Problem

    ScottPletcher (11/16/2015)


    [Yes, (maybe) that gives you less fragmentation on the base table, but that's irrelevant if you (almost) never look up by the id anyway!!

    I'd say it this way:

    But...

  • RE: Special Characters

    Those are double-byte characters. They have corresponding HEX values, but not single byte ones.

    SELECT CONVERT(VARBINARY, N'?')

    You can search for them, but you must specify them as UNICODE:

    WHERE [Column] like N'%?%'

  • RE: Query Performance Problem

    ScottPletcher (11/16/2015)


    but still cluster the table on the RedemptionCode.

    Clustering a column with randomly generating values is not the best approach ever.

    It's as bad as setting a GUID as clustered...

  • RE: Query Performance Problem

    You are using different data types for RedemptionCode and @RedemptionCode.

    When you check for existence you compare values of different data types, which forces implicit conversion.

    When an operator combines two expressions...

  • RE: DataType Conversion

    David Rich (11/9/2015)


    While going through execution plan i observed this warning

    Type conversion in expression (CONVERT_IMPLICIT(varchar(255),[e].[abc],0)) may affect "CardinalityEstimate" in query plan choice

    and this is getting converted to nvarchar(255). Will...

  • RE: In vs Outer Join

    Both options suck.

    WHERE (NOT) EXISTS

    does the job way more effectively.

    And NULL handling is much more clear in this case.

  • RE: Rename a network file using xp_cmdshell

    What PRINT shows you?

  • RE: Selecting text between set characters

    Here is some old school solution.

    Should make the logic crystal clear.

    And it's set based, works on a table, so may be easily made into a view.

    DECLARE @Table TABLE (

    Col varchar(500)

    )

    DECLARE...

  • RE: DIFFERENCE BETWEEN NOLOCK VS WITH(NOLOCK) IN SQL SERVER 2008

    I would suggest (if NOLOCK is a requirement) to use NOLOCK, not WITH (NOLOCK).

    NOLOCK without brackets is not a hint, but a table name alias.

    So, the query would be using...

  • RE: Find previous date from table.

    Kristen-173977 (11/4/2015)


    If you want other columns, from the row that has the next most recent date, then:

    select TOP 1 Col1, Col2, ...

    FROM @tempdat

    where repdate < @StartDate

    ORDER BY repdate DESC,...

  • RE: Merge Two Querries to have only 1 output

    UNION ALL ?

  • RE: Query on a large database

    GilaMonster (11/1/2015)


    Sergiy (11/1/2015)


    Gail, I'm talking from experience.

    Three times this year I've had to assist with the restore of a production backup to recover deleted data (2 cases)

    Oh, I see your...

Viewing 15 posts - 1,831 through 1,845 (of 6,036 total)