Forum Replies Created

Viewing 15 posts - 3,481 through 3,495 (of 10,144 total)

  • RE: Are the posted questions getting worse?

    Sean Lange (3/28/2014)


    ChrisM@Work (3/28/2014)


    Sean Lange (3/28/2014)


    dwain.c (3/28/2014)


    Ville-Pekka Vahteala (3/27/2014)


    Luis Cazares (3/27/2014)


    How is it possible that someone writes a cursor instead of using SUM()?

    I'm afraid that this database is full of...

  • RE: Are the posted questions getting worse?

    Sean Lange (3/28/2014)


    dwain.c (3/28/2014)


    Ville-Pekka Vahteala (3/27/2014)


    Luis Cazares (3/27/2014)


    How is it possible that someone writes a cursor instead of using SUM()?

    I'm afraid that this database is full of these pieces of...

  • RE: Are the posted questions getting worse?

    WayneS (3/27/2014)


    Luis Cazares (3/27/2014)


    How is it possible that someone writes a cursor instead of using SUM()?

    I'm afraid that this database is full of these pieces of sh code and it's...

  • RE: Are the posted questions getting worse?

    Luis Cazares (3/27/2014)


    How is it possible that someone writes a cursor instead of using SUM()?

    I'm afraid that this database is full of these pieces of sh code and it's slower...

  • RE: Simple Query taking 8 secs

    Can you post the actual plan for the most recent version?

  • RE: Simple Query taking 8 secs

    Have you tried resolving out the tables from the strings? Something like this:

    SELECT * -- change to column name

    INTO #OrgCommCode

    FROM dbo.Fn_splitstrings(@p_OrgCommCode, ',')

    SELECT * -- change to column name

    INTO #CommCode

    FROM dbo.Fn_splitstrings(@p_CommCode,...

  • RE: Simple Query taking 8 secs

    You could replace four of those UNIONs with one:

    SELECT *

    FROM #tempac

    UNION ALL

    SELECT e.*

    FROM ( -- e

    SELECT

    d.finyr,

    d.minyr,

    d.finmonno,

    d.finmonname,

    d.[activitytypeorder],

    d.activitytype,

    m.ha_code,

    d.nhs_e_contract_id,

    d.age_flag,

    d.Number

    FROM ( --...

  • RE: UPDATE not updating data in table

    joepacelli (3/19/2014)


    The UPDATE looks like

    You wouldn't believe how often folks have been caught out by omitting a seemingly inocuous bit of code from a query, only to find it's the...

  • RE: Multiple updates in 1 table from another table

    Look up UPDATE...FROM in Books Online. There are examples which very closely match your requirement.

  • RE: Need a query to select aggregate data by buckets

    SQL Guy 1 (3/25/2014)


    That was rather simplified example. In reality I have a table with 150 mln records, and it is partitioned by integer column (it is some ID...

  • RE: Reg bedrents calculation in HIS stored procedure

    This is the finest example I’ve seen in a long time of how not to code against SQL Server.

    Picking out single rows from one table at a time and...

  • RE: Long Running SQL Query .. Looking for recommendations for improvement.

    Lynn Pettis (3/24/2014)


    Also, it could just be me, but after downloading the estimated execution plan I was unable to open it.

    Me neither, think it was truncated.

    However: very high row...

  • RE: Long Running SQL Query .. Looking for recommendations for improvement.

    Your GROUP BY eliminates the need for DISTINCT

    SELECT --DISTINCT

    s.site_number AS Site,

    s.city AS City,

    s.state AS State,

    SUM(CASE WHEN hp.histConfID LIKE '%Generator$20Start$2fStop'

    THEN CONVERT(DECIMAL(10, 2), h.numeric_value / 100 *...

  • RE: Select Top x% From Group Based on Total

    tfendt (3/24/2014)


    ChrisM@Work (3/24/2014)


    tfendt (3/24/2014)


    ChrisM@Work (3/24/2014)


    Have a look at the NTILE function in Books Online (SQL Server help).

    NTILE(n) splits the data into n equal-sized partitions numbered 1 to n in...

  • RE: Select Top x% From Group Based on Total

    tfendt (3/24/2014)


    ChrisM@Work (3/24/2014)


    Have a look at the NTILE function in Books Online (SQL Server help).

    NTILE(n) splits the data into n equal-sized partitions numbered 1 to n in a user-defined...

Viewing 15 posts - 3,481 through 3,495 (of 10,144 total)