Forum Replies Created

Viewing 15 posts - 3,016 through 3,030 (of 4,085 total)

  • RE: CTE (?) or query help

    Without test data, it's hard to say, but I believe that this query will give you the same results, while being MUCH, MUCH simpler. I'm guessing it will also...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Help in making query for presenting data in different format

    Isn't this the same question that you asked before?

    http://www.sqlservercentral.com/Forums/Topic1693743-3077-1.aspx

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Update or something else

    I'm guessing the problem is with the BETWEEN on your datetime field in the WHERE clause. There are a number of issues with using BETWEEN with datetime data. ...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: How to batch delete large table?

    codykonior (6/16/2015)


    And you don't need two temporary tables when one will do.

    You don't need any temporary tables at all. The temporary tables just add unnecessary overhead.

    DECLARE @Row_Batch INT =...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Problem in procedure

    j.grimanis (6/16/2015)


    Hi all,

    I do not want to confuse people, especially when they are trying o help me.

    Below is a sample of how stored procedure seems :

    PROC1

    -----Procedure1 is calling...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Problems with TRANSACTIONS after moving to a new server

    Try moving your variable declarations/assignments outside of your TRY/CATCH blocks. I'm guessing that the behavior of variable assignments in TRY/CATCH blocks is different between the two versions of SQL...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: SQL Join

    sgmunson (6/15/2015)Also, just as a general rule, almost no one uses RIGHT joins because it's just not intuitive.

    I've actually wondered about this. I know this is true of left-to-right...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Join 2 reference values in one line ...

    You simply have to join to the table twice with different aliases, which is essentially what you were doing by creating two CTEs.

    select o.ID, o.OrderNumber, s.MarketCenterCity AS 'SourceMKT', d.MarketCenterCity AS...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Data comes correct with Select but when convert it to update, it does not work

    Shadab Shah (6/11/2015)


    Below is the error

    Msg 4108, Level 15, State 1, Line 2

    Windowed functions can only appear in the SELECT or ORDER BY clauses.

    The way to get around this is...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Gathering Stored Procedure execution time in real time?

    Yes, it is possible, but I have never done it. You'll need to use the built-in Dynamic Management Views (DMV), specifically sys.dm_exec_requests which gives you information about currently running...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Select Maximum, using filelds from 2 tables

    ScottPletcher (6/11/2015)


    You can't add Librarian id into the GROUP BY and accurately answer the query, since multiple librarians could have the same surname. You could pre-aggregate, but you must...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Select Maximum, using filelds from 2 tables

    Luis Cazares (6/11/2015)

    When doing such strong and conclusive statements, you should show proof of that.

    You're right, of course.

    I can't give a conclusive statement even after some testing that shows that...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Select Maximum, using filelds from 2 tables

    Luis Cazares (6/11/2015)


    koles2004 (6/11/2015)


    I wanna specify: the second your variant is faster than first ?

    I can't assure that it's faster or better. The only way to ensure that is by...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: help in making query

    sqlinterset (6/11/2015)


    I would like to display NULL.

    Then you will need to add a CASE statement like so

    ;

    WITH complaints_ordered AS

    (

    SELECT

    Fiscal_Week,

    Complaint_Num AS c1,

    CASE WHEN LAG(Fiscal_Year) OVER(PARTITION BY Fiscal_Week ORDER BY Fiscal_Year) =...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: help in making query

    This gives the expected results with the data supplied, but you haven't said what the expected behavior should be when 2012 and 2014 have data, but 2013 and 2015 don't....

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,016 through 3,030 (of 4,085 total)