Forum Replies Created

Viewing 15 posts - 1,951 through 1,965 (of 8,731 total)

  • RE: Assigning a record count to a variable for comparison purposes

    There's no need for dynamic code. You just need to query a system view with a parameter.

    SELECT SUM (row_count)

    FROM sys.dm_db_partition_stats

    WHERE object_id=OBJECT_ID(?)

    AND index_id IN( 0, 1);

    This will be...

  • RE: CASE WITH EXISTS

    I believe that Sean means something like this:

    SELECT TOP 1 *

    FROM(

    SELECT TOP 1

    CONCAT(i.BatchId,+'_'+ i.Company+'_',ltrim(rtrim(i.[Accounting Period]))+'_nondlo.saf')

    , 1

    ...

  • RE: CASE WITH EXISTS

    Why don't you simply use

    SELECT CONCAT(i.BatchId,+'_'+ i.Company+'_',ltrim(rtrim(i.[Accounting Period]))+'_nondlo.saf')

    FROM [Havebury].[RepairInvoice].[RepairInvoiceNONDLO] i

    Instead of using subqueries and CASE clauses?

  • RE: Today's Random Word!

    Manic Star (10/31/2016)


    Ed Wagner (10/31/2016)


    Grumpy DBA (10/31/2016)


    djj (10/31/2016)


    Remington

    Shaver

    Beard

    Lady

    Marmalade

  • RE: What random trash is in your drawer?

    Steven.Grzybowski (9/27/2016)


    Eric M Russell (9/26/2016)


    Steven.Grzybowski (9/26/2016)


    A locked box.

    Inside that locked box is medication. Lots and lots of medication. My regularly prescribed daily meds, every OTC NSAID...

  • RE: SSIS and column restrictions

    Lynn Pettis (10/28/2016)


    Luis Cazares (10/28/2016)


    Why aren't you using flat files to transfer the data so you don't have to deal with additional storage needed by spreadsheets?

    Also, depending on the driver,...

  • RE: SSIS and column restrictions

    Why aren't you using flat files to transfer the data so you don't have to deal with additional storage needed by spreadsheets?

    Also, depending on the driver, you can get a...

  • RE: Recursive CTE performance improvement

    I´m not sure what to say. You should know the deal by now. We need DDL, sample data and expected results.

    The query that I posted gives the exact same result...

  • RE: Recursive CTE performance improvement

    sqlfriends (10/27/2016)


    I have a table valued function to count student truant days in any passed 30 days that met threshold of 7 days and return the earliest passed threshold date.

    I...

  • RE: why my query returns scientific notation for a varchar field?

    halifaxdal (10/27/2016)


    found a simple solution: select str(column)

    PS. the above query is producing wrong result, changing 1234565789 to 123456000, I'm keep searching for a simple solution now

    That's because once the value...

  • RE: Update Query Help in T-SQL

    Include the columns in the derived table by using MIN or MAX on them.

    Then use a CASE clause to update only when the row_count = 1.

  • RE: DTA - want to delete dta indexes

    I think you're confusing the indexes created using DTA, with the indexes created during the DTA analysis but usually removed after the process completes. These later indexes are hypothetical and...

  • RE: Can anyone help optimize runtime on a dimension creating query?

    Thom A (10/27/2016)


    Luis Cazares (10/27/2016)


    This runs several times faster. I just can't understand why the FORMAT function is so slow.

    I really wish it wasn't. It's a lazy man's dream. :hehe:

    I...

  • RE: Can anyone help optimize runtime on a dimension creating query?

    This runs several times faster. I just can't understand why the FORMAT function is so slow.

    The TOP also prevents generating all the row numbers which gives an additional boost.

    DECLARE @Hour_Quarter_ID...

  • RE: ROUND numbers with steps

    Lynn Pettis (10/27/2016)


    Luis Cazares (10/27/2016)


    Here's an example of the different behavior of ROUND and CEILING/FLOOR.

    Luis, your expected return values for the negative values are wrong. Rounding negative values up...

Viewing 15 posts - 1,951 through 1,965 (of 8,731 total)