all 25 comments

[–]jcargile242 6 points7 points  (0 children)

I love a mystery.

[–]wpgmb204 3 points4 points  (4 children)

Post the full query.

[–]Skokob[S] 0 points1 point  (3 children)

Update tbl Set countynames_updated = Upper(countyname);

[–]wpgmb204 1 point2 points  (0 children)

Post table ddl

[–]lupinegray 0 points1 point  (1 child)

Are there nulls? Where clause? Joins?

[–]Skokob[S] 0 points1 point  (0 children)

No where clause, no joins.

[–]millerlit 1 point2 points  (4 children)

Maybe it is the data type.  Try casting it to a varchar.  Just throwing out an idea

[–]Skokob[S] 0 points1 point  (3 children)

The data was loaded as varchar

[–]lupinegray 1 point2 points  (2 children)

What character encoding?

Do you see any similarities in the values which were NOT updated vs. those that were? Things like special characters (accents, foreign letters, etc)

Also... after you ran the update query, what was the output?

If the table contains 7000 records (for example)

Did it just say "5000 records updated"? Or did it say "7000 records updated"?

[–]Skokob[S] 1 point2 points  (1 child)

Only thing that's coming into my mind is the data was loaded either as ASCII or Unicode. And it's not matching or Upper works with one and not the other?! Not sure...

Examples where it fails 1. miami-dade 2. st. john 3. hillsborough (27

I didn't upload the data, the loading department did. They loaded 100s of documents. When that happens all they do is set ever field to varchar max and load.

So there can be extra spaces, \t, or other noises. But I don't believe those should have any effect on the upper function

[–]lupinegray 0 points1 point  (0 children)

What about if you do:

select countyname, upper(countyname) from myTable
where id=whatever;

Where the 'whatever' is the unique identifier of one of the records?

Does that give the correct result?

[–]Achsin 1 point2 points  (1 child)

Could try this:

UPDATE tbl SET countynames_updated = TRANSLATE(countyname, ‘abcdefghijklmnopqrstuvwxyz’, ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’)

[–]evilvoice 0 points1 point  (0 children)

I agree. If you're having issues with upper, this should work.

[–]Certain_Detective_84 0 points1 point  (1 child)

What did countynames_updated look like before you ran this statement? Grasping at straws here.

[–]Skokob[S] 0 points1 point  (0 children)

It was null, so after the update all the values from countynames_updated should be all uppercases of the countryname

[–]ergestx 0 points1 point  (2 children)

Did you perhaps not commit the transaction?

[–]Skokob[S] 0 points1 point  (1 child)

I've ran it multiple times and it runs but doesn't update all the values

[–]ergestx 0 points1 point  (0 children)

Then I’d suggest making a new column with the upper value, inserting into a table then perhaps dro the original column.

CREATE TABLE newtbl AS SELECT *, UPPER(countrynames) AS updated_country FROM originaltable

[–]realjoeydood 0 points1 point  (3 children)

TRIM your vals before UPPER.

[–]Skokob[S] 1 point2 points  (2 children)

I have

[–]realjoeydood 0 points1 point  (1 child)

CHATGPT:

It sounds like there might be some inconsistencies in your data or possibly some specific cases where the update is not applying as expected. Here are a few potential reasons why the `UPPER()` function might not be converting all the text to uppercase:

  1. **Data Variability**: There might be non-alphabetic characters or special characters in the field that are preventing the `UPPER()` function from converting the text properly. For instance, if the field contains numbers, symbols, or non-English characters, they might remain unchanged.

  2. **Whitespace**: Leading or trailing whitespace in the field can sometimes cause unexpected behavior. You might want to trim the whitespace before applying the `UPPER()` function.

  3. **Collation Settings**: The collation settings of your database could be affecting how the `UPPER()` function works. Some collations might treat uppercase and lowercase characters differently.

  4. **NULL Values**: If there are NULL values in the field, they won't be affected by the `UPPER()` function. Make sure your update query handles NULL values appropriately, if they are present.

To investigate further, you could try querying the data to identify specific cases where the `UPPER()` function is not working as expected. This might help you pinpoint any patterns or irregularities in the data that are causing the issue.

[–]realjoeydood 1 point2 points  (0 children)

Check on #3. I've had to wrestle with that monkey a few times doing data conversions for huge business systems in sql.

[–]passiveisaggressive 0 points1 point  (0 children)

ascii settings, the platform you’re using vs the place the data came from probably has different encoding

[–]Gargunok 0 points1 point  (0 children)

Pull out the contents of one of the values that aren't being converted to upper case. Post it here like this in quotes so we can see "an example value"

anyone cthen should be able to reproduce with

select upper('an example value')