Forum Replies Created

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

  • RE: subquery

    It's simple enough to test. Why don't you try it and report back the results?

    Drew

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • RE: inconsistent of a select then update.

    If you have a one-to-many join, the count for the SELECT will be the count for the many side of the join, but the count for the UPDATE will be...

  • 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...

  • RE: Stored Proc to split data in two

    Try NTILE().

    Drew

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • 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,...

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