Forum Replies Created

Viewing 15 posts - 706 through 720 (of 1,193 total)

  • RE: Script of Updates Stats

    Something like this should get you close if you're actually on 2008 R2 or later:

    SELECT table_name=object_name(s.object_id),

    stats_name=name,

    ...

  • RE: Version Store and Index Seeks

    For a little extra fun, you can even see that ghost records are being retained because of snapshot isolation if you run sys.dm_db_index_physical_stats using DETAILED mode. There's a handy column...

  • RE: Unpredictable results

    Eric M Russell (1/7/2016)


    Here you appear to be selecting TOP X rows without an explicit sort order. I'm assuming that ORDER BY (SELECT NULL) is essentially nullifying the sort order,...

  • RE: Unpredictable results

    There have been a few problems like this that seem tied to parallelism. Running with the clustered index and OPTION (MAXDOP 1) yields deterministic results again.

    There was this early bug...

  • RE: CTE Adding a value to a 'datetime' column caused an overflow

    The immediate problem is the location of your clause that restricts the results to dates before today.

    Right now it's in the NOT EXISTS subquery, which means that once rows start...

  • RE: Selecting a decimal

    Luis Cazares (1/6/2016)


    Hugo Kornelis (1/6/2016)


    sql_only (1/6/2016)


    why does

    DECLARE @phi DECIMAL = (SQRT(5)+1)/2

    SELECT @phi;

    return 2

    and not 1.618

    Integer math.

    The data used as input in the formula are all integers, so the intermediate results...

  • RE: Help in using date range

    AND in this case separates filter conditions. <='2014-12-31' by itself is not a valid condition. You need this for the last two conditions:

    transaction_date>='2013-01-01' and transaction_date<='2014-12-31'

    Cheers!

    EDIT: Inside code tags my greater...

  • RE: Limiting Access to the Secondary (Read Only) Node of High Availability Group

    I'm not aware of any way to force connections to the read-only replica for particular logins.

    When I've needed logins to have permissions solely on the read-only secondary, I've just created...

  • RE: Help with a query, plz

    No need to be too sorry; we all skip over things when reading sometimes. Goodness knows I have 🙂

    I'm glad it's working for you!

    Cheers!

  • RE: Help with a query, plz

    Read my post a bit more closely 🙂

    Jacob Wilkins (12/29/2015)


    There would also be duplicates if the same parent occurred on different rows in vw_csys_NurserySchool. You could just do a DISTINCT...

  • RE: Help with a query, plz

    There would also be duplicates if the same parent occurred on different rows in vw_csys_NurserySchool. You could just do a DISTINCT in the outer SELECT (i.e., SELECT DISTINCT females_only.*) to...

  • RE: Help with a query, plz

    It's still not at all clear what you're wanting.

    If you could give us sample data and your expected results from that sample data, we'd probably be able to solve this...

  • RE: Nvarchar Max no of character size

    Phil Parkin (12/29/2015)


    drew.allen (12/29/2015)


    Your client may be limiting the number of characters returned. It may limit either the total returned or the amount returned per column. For instance,...

  • RE: Get two sales item code exclusively from invoice

    I read the original request as requiring the invoice to have both items 111 and 222, and ONLY items 111 and 222. Is that correct?

    Either way, the approach using...

  • RE: Need help on Grouping

    It seems that's a pretty straightforward query, where you just want the sum of one column, grouped by another set of columns, and the desired result set is just the...

Viewing 15 posts - 706 through 720 (of 1,193 total)