Forum Replies Created

Viewing 15 posts - 61 through 75 (of 4,080 total)

  • Reply To: update using self-join - confirm it looks at old values

    BUT, within the context of the same transaction you see the changes prior to the commit.

    (Used a temp table here because table variables,  like all variables, retain their current values...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: update using self-join - confirm it looks at old values

    Here is an illustration that may help.    Note that both columns don't wind up with the original value of V2 until the update   ends (commits).

    declare @table...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Preventing concurrent inserts

    GUIDS are big, fat and ugly...   they bloat indexes.   😀

     

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Looking for US state geospatial shape data

    Try googling "State Geographies Downloads".

    Also, keep in mind that airlines and ships follow a great circle route between ports.   Over long distances, pythagorean theorem (straight-line geometry) calculations won't work for...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Newb - SQL Server IIF() Function

    Might be easier if you showed us a couple of examples of values for Var1Title, Var1Topic, and Var1Name... and what you expect the result to be.   🙂

     

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Lots of CTE and dynamic query

    I would like to echo Brian's comments.    Improving SQL code depends on an understanding of the data, the execution plan, the table and index structures, etc.     Given enough...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Counting the number of unique days between ranges of dates

    The solution seems much simpler, once you look at the data sorted by startdate and enddate within each IdentityID.    A gap only occurs when the current start date is...

    • This reply was modified 5 years, 3 months ago by The Dixie Flatline. Reason: Had the wrong version of code. TotalDays wasn't calculated correctly

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Array into table.

    1. Copy your data into a staging table.
    2. Replace all opening square brackets "[" and quote marks with space(0) to make your string look like this:

      1613347200,7],1613347205,6],1613347210,7]

    3. Replace all close square...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: How to get the last occurrence of a field

    Since you are sorting by OpNum within WONum, your "last occurrence" is the same thing as the maximum value of OpNum.  You even stated it was the "highest value."   So....

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Check if File Exists with Dynamic Name

    If the file name always starts with the string "Feed_" you can build the file name in a variable and pass it instead of a constant.

    DECLARE @fileExists...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Using a SET statement inside of a CASE Statement

    Conceptually, you must always remember that CASE is an expression, not a statement.   You use it just as you would use a function, or a formula, to deliver a single...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Not selecting numbers in first 3 characters of cell only letters

    I agree that you aren't specific about what to do when the first three characters are something like N2X.     What if you have the string 'N2XY45689'?    Do you...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Now Is a Good Time for Choices

    The world has more than it's share of ignorant, irresponsible people.    All the rest of us can do is try to minimize the impact they have.    Hope all...

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Row_Number for grouping to find min and max values

    Yes, I missed the concept.   I was simply keying off the PASSOB column.   I'll go back and re-read more carefully. Apologies.

     

     

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Reply To: Row_Number for grouping to find min and max values

    Withdrawn.  I didn't look at the expected result set carefully.

    • This reply was modified 6 years, 6 months ago by The Dixie Flatline. Reason: Didn't pay attention to what the expected result set should look like

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 15 posts - 61 through 75 (of 4,080 total)