Forum Replies Created

Viewing 15 posts - 3,076 through 3,090 (of 4,085 total)

  • RE: need help replacing cursor logic in stored procedure w/faster sql statement

    Dave C. (8/20/2012)


    are there any other ways of accomplishing this?

    Why do you ask? Is there something wrong with the proposed solution, such as your neglecting to tell us that...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: need help replacing cursor logic in stored procedure w/faster sql statement

    Try the following:

    SELECT ord_oda_id, token, ISNULL(ord_id, 5000) AS ord_id

    FROM xx_pm_receipts

    OUTER APPLY (

    SELECT TOP (1) ord_id + 1 AS ord_id

    FROM xx_ordid_tracker

    WHERE poid = ord_oda_id

    ORDER BY ord_id DESC ) AS ot

    WHERE token...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Yet another rows to column question (sorry)

    If you're trying to do what I think you are, then the answer is that you can't do it in SQL. First Normal Form for databases is that all...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: comma in SQL

    GSquared (8/13/2012)


    CTEs don't start with a semicolon.

    I disagree. While I'm sure that the intention is that the statement before must end with a semicolon, implementation and general practice clearly...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Creating a table

    STOP!!!! You're opening yourself up to a very serious security risk. Identity theft is a very big problem and the primary source is SSNs from hacked databases.

    You should...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Urgent help please !!

    Scott D. Jacobson (8/7/2012)


    You should NEVER use BETWEEN with datetime data.

    Do you have any more material on this or is it purely anecdotal? For instance, what's wrong with this?

    The issue...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Stored Proc to split data in two

    Try NTILE().

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Urgent help please !!

    You should NEVER use BETWEEN with datetime data. Your query assumes a precision of 1 second when the actual precision of datetime data is 3 milliseconds, so you are...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: URGENT HELP PLEASE

    CELKO (8/7/2012)


    It looks like you use assembly language bit flays

    Until SQL support Boolean datatypes, bit flags are the next best thing.

    , but you did not bother to post any DDL...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: 0 is equal to zero length string. Can someone explain how this can be?

    I think that we would all agree that the following strings should all produce the same results when converted to an integer:

    ' 1'

    '01'

    So, it makes sense to me, that if...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: URGENT HELP PLEASE

    Note that "b.date_deactivated is not NULL" is superfluous. If b.date_deactivated is NULL then the result of "b.date_deactivated < '7 aug 2012'" will also be NULL. So, in order...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Intersecting Date Ranges

    As Joe alluded to, there is a much simpler method of calculating intersections. The standard uses only two dates, but it easily be modified to account for multiple dates.

    SELECT...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Procedure causes out of memory error

    Without data, it's hard to say what the best approach is, but consider using CROSS APPLY instead of the CURSOR. Here's something that will help get you started.

    SELECT EvaluateeEvaluationID,...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Update sortorder column to +1

    kaushal_shah26 (8/2/2012)


    I googled the syntax and changed the query to include partition and also pull only records where isactive =1. The reason for pulling only isactive = 1 is we...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • RE: Update sortorder column to +1

    kaushal_shah26 (8/2/2012)


    Thanks for the code. It works for the sample code. Now, How do we do this for all types. In the sample code, we only have one type which...

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 15 posts - 3,076 through 3,090 (of 4,085 total)