Forum Replies Created

Viewing 15 posts - 4,621 through 4,635 (of 7,597 total)

  • RE: Query Performance Problem

    Sergiy (11/18/2015)


    ScottPletcher (11/18/2015)


    Of course. But that doesn't mean I have to store decades worth of obsolete numbers in my main table, now does it? If the number is...

  • RE: Query Performance Problem

    Sergiy (11/18/2015)


    ScottPletcher (11/18/2015)


    First, how do you know that inactive codes are routinely searched? That's almost never the case.

    Mobile top up numbers. Gift cards. iTunes cards. Game access codes. Software...

  • RE: Read 1st line of a file in t-sql

    I suggest trying the BULK INSERT command, since you can stop it after only one row. Specify a never-found field terminator to make sure you read the entire first...

  • RE: How to take the output of the command to a table (specially first two columns) to get logical name and physical name?

    I would think first create a temp table that matches the output of that command:

    CREATE TABLE #filelistonly ( ... )

    then do this:

    INSERT INTO #filelistonly

    EXEC('restore filelistonly from disk = ''G:\folder1\backupfile091.bak'')

    Finally, of...

  • RE: Query Performance Problem

    Sergiy (11/17/2015)


    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...

  • RE: Unable to print the charindex of a special character of its 4th occurrence.

    SQL-DBA-01 (11/17/2015)


    What's wrong in this query?

    SELECT CHARINDEX('_', name) FirstIndexOf,

    --CHARINDEX('_', name)+1,

    CHARINDEX('_', name, (CHARINDEX('_', name)+1)) SecondIndexOf,

    charindex('_',name, CHARINDEX('_',name,(charindex('_',name ) + 1 )) + 1 ) ThirdIndexOf,

    charindex('_',name,CHARINDEX('_',name,(charindex('_', name ,(charindex('_',name ) + 1 )) +...

  • RE: Date Difference

    First you'll need to decide how you want to handle birthdays on Feb 29. In non-leap years, do you want to treat Feb 28 as the birthday, or March...

  • RE: select string between two ',' symbols

    insert into #test values

    ('2100110'),

    ('2100110,12')

    select

    HID,

    case when last_comma = 0 then HID

    when next_to_last_comma = 0 then LEFT(HID, LEN(HID) - last_comma)

    else...

  • RE: Query Performance Problem

    Sergiy (11/16/2015)


    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...

  • RE: Query Performance Problem

    Sergiy (11/16/2015)


    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...

  • RE: SP querying another database - No error when column name is incorrect

    Arjun Sivadasan (11/16/2015)


    ScottPletcher (11/16/2015)


    If the table does not exist at all, SQL defers name resolution ("deferred name resolution") for that table.

    <snip/>

    Thanks for the reply Scott. If a table does not...

  • RE: Query Performance Problem

    Sergiy (11/16/2015)


    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.

    That's a drastic overstatement. Remember, the table...

  • RE: Shrinking Database

    The best solution is to tune the existing indexes, starting with verifying that you have the best clustered index on every table. Btw, empty/unused space within the db will...

  • RE: Query Performance Problem

    I don't think SQL will have to use an implicit conversion for varchar to char, since it pads spaces when doing character comparisons anyway. Not 100% sure, so I'd...

  • RE: SP querying another database - No error when column name is incorrect

    If the table does not exist at all, SQL defers name resolution ("deferred name resolution") for that table. That is, it waits until run time, then checks to see...

Viewing 15 posts - 4,621 through 4,635 (of 7,597 total)