Forum Replies Created

Viewing 15 posts - 3,676 through 3,690 (of 4,085 total)

  • RE: How to Delete Right 3 Characters from a string

    Sugsy (7/22/2011)


    Just for the record Kingston's suggestion works fine n'all

    Actually, it doesn't. It works as long as the last three characters aren't repeated anywhere else in the string, but...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Performance Tuning Of SQL using ISNULL in JOINS

    Eric M Russell (7/21/2011)


    SQL_By_Chance (7/21/2011)


    Assuming that changing the data is not an viable option, then I suggest you try modifying the SQL like below, doing a left outer join(s), and...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Google Analytics XML file to SQL2005 table

    It helps if you provide expected output based on the data provided. As it is, I had to guess at what you were looking for.

    The following code should at...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: General questions about Analysis Services

    There is a separate forum for Analysis Services http://www.sqlservercentral.com/Forums/Forum17-1.aspx. You might get a better answer in that forum.

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Week Grand Total not equal to sum across 7 days

    It's not an arbitrary behavior, it's just that you can't predict the value for the week based on the values for each day.

    If the same five users log in every...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Week Grand Total not equal to sum across 7 days

    From BOL http://msdn.microsoft.com/en-us/library/ms175623.aspx:

    SSAS aggregrate functions fall into three categories: additive, semiadditive, and nonadditive.

    DistinctCount is nonadditive, which is why you don't get the results you expect when you compare the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: String to Paragraph.

    Lowell (7/11/2011)


    this seems to work for me:

    The OP asked to specifically break on spaces. This only seems to work, because this particular test string has spaces at positions 60...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to find count of employee's/count of names of employee's as per first character

    kramaswamy (7/7/2011)


    select Letter, COUNT(*)

    from #Letters

    LEFT JOIN Emp ON SUBSTRING(Name,1,1) = Letter

    group by Letter

    SUBSTRING is not SARGable, so it's better to write this using LIKE.

    select Letter, COUNT(*)

    from #Letters

    LEFT JOIN Emp ON...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: formatted xml with 'for xml'

    Use FOR XML PATH instead of FOR XML AUTO.

    Another options is to use the ELEMENTS directive.

    FOR XML AUTO, ELEMENTS

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: COMPUTE clause #1, aggregate expression #1 is not in the select list.

    The expression in the COMPUTE clause's aggregate has to EXACTLY match an expression in the SELECT clause. Your SELECT clause contains a function call, whereas your COMPUTE clause does...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Duplicate key error when inserting into a table that has no records!!! Please help!

    The problem is with the following fields: mersum.subisonum and mersum.repnum.

    You're grouping on the actual values (including NULLs), so you could potentially have a row with NULL and another with 0...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to find highest paying two employee for each dept

    sqlusers (6/30/2011)


    Please check the below.

    CREATE TABLE tblGetEmp (EmpName CHAR(8),Salary INT,Dept CHAR(1))

    INSERT INTO tblGetEmp

    SELECT 'aaa',10000,'a' UNION ALL

    SELECT 'bbb',16662,'a' UNION ALL

    SELECT 'rrr',73637,'a' UNION ALL

    SELECT 'jhfdj',87683,'b' UNION ALL

    SELECT 'jhk',7382,'b' UNION ALL

    SELECT 'ewkjhk',98798,'b'...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: hi

    opc.three (6/29/2011)


    UNION ALL used how it was just shown in your post (as a 2005-compliant row constructor equivalent to VALUES() ) will allow you to use the APPLY technique in...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: hi

    opc.three (6/29/2011)


    Itzik has it down, use the APPLY operator for this. UNION ALL will scan the data multiple times, APPLY will only scan it once, and it's cleaner than the...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: hi

    Here is why UNPIVOT doesn't work with multiple sets of data.

    Suppose you have the row:

    JOB Name1 Name2 ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,676 through 3,690 (of 4,085 total)