Forum Replies Created

Viewing 15 posts - 3,271 through 3,285 (of 4,085 total)

  • RE: Select Query, but being picky about the Rows Returned

    Chris Harshman (3/23/2012)


    interesting problem, I think windowed functions work well here:

    I've found that the windowed aggregates do a LOT of reads. You might be better off using a NOT...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: how to dynamically create columns for single row result set.

    Actually, the correct answer (assuming that your date fields are actual date fields) is that it's IMPOSSIBLE. Your expected output violates first normal form, because some of the rows...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Merge statements and how to get around them...?

    Assuming that there is some date changed associated with each of the changes, use that to determine which change is more recent.

    Option 2 is to update the source of the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Merge statements and how to get around them...?

    Your criteria for which rows to update in your merge is incomplete. Since you forgot to include the DDL for your tables, sample data, expected results, and your current...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: sargability, optimized execution plans, their caching, dynamic sql, and or highly modularized stored procedures.

    Snargables (3/21/2012)


    To be honest based on the above info i suppose my only issue w/ dynamic sql now is its readbility. It's just plain ugly.

    A lot of that may depend...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Display all the users with group descriptions for semicolon seperated values.

    Someone else recently posted the exact same question, so this looks like a homework assignment. I suggest you try it on your own first.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Joined Update

    captcooldaddy (3/20/2012)


    or wrap in sinulls

    also only the records who need to be update...removed left join

    UPDATE t1 SET field1 = t2.field1

    FROM Table1 t1 JOIN Table2 t2 ON

    t2.id1 = t1.id1

    AND t2.id2 =...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: A strange T-SQL challenge

    SGT_squeequal (3/20/2012)


    Like other people suggest i would approach this using a pivot table, why does you boss object to a using pivot?

    You do realize that that comment was made THREE...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Joined Update

    captcooldaddy (3/20/2012)


    also only the records who need to be update...removed left join

    UPDATE t1 SET field1 = t2.field1

    FROM Table1 t1 JOIN Table2 t2 ON

    t2.id1 = t1.id1

    AND t2.id2 = t1.id2

    where...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Filtering with @variables

    Sean Lange (3/20/2012)


    Drew I am curious if you have seen performance improvements with this multiple queries over the way I posted above. Or is it just personal preference?

    Just to be...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: PATINDEX equivalent

    I don't know MySQL either, but here is an approach using a Tally table. (I may have the syntax for REGEX wrong.)

    SELECT Min(n) AS n

    FROM YourTable

    INNER JOIN Tally

    ON Len(YourTable.YourString)...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: MonthToDate function?

    It's easy to calculate the beginning of the month using the following function.

    DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)

    You can then use that in your CASE expression or WHERE clause as appropriate.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Filtering with @variables

    With only one parameter, the dynamic SQL option is probably overkill. Here is another option that I have seen, which is fine with only one parameter.

    IF @StaffID IS NULL...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: ODBC Date in OpenQuery

    The error is coming from your Caché database, so you'll probably get a better answer from a Caché forum, but it looks like Caché doesn't support the DATE datatype.

    Another...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Accessing SQL Server with other Client tools

    itskanchanhere (3/15/2012)


    Guys, I need an answer in general. What can be the disadvantages of using any 3rd party tool other than sql server mgnt studio.. I dont answer specific to...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,271 through 3,285 (of 4,085 total)