0

I would like to convert all the data if in lower case in snowflake table to upper case.

I have multiple catalogs, schemas and then tables. Would like to do this with Python.

Is there a straight query on table to convert all the data (columns) into upper case?

I have the following query, but I would like to do it for a specific data type and for only data that

is lower case(If this is faster) else for the entire table..

UPDATE MyTable

SET MyColumn = UPPER(MyColumn)

WHERE MyColumn != UPPER(MyColumn) COLLATE Latin1_General_CS_AS

How do I do it for multiple columns at once for the table??

Manak
  • 27
  • 2
  • 8

1 Answers1

0

One solution I can think of here is get all the columns from information_schema like this

select COLUMN_NAME from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = <>

Once you get the query result of columns formulate your SELECT statement by using UPPER(<column_a>) dynamically.

This can be done in python(as this seems to be your choice here) easily.

Let me know if that helps.

  • Hi! Can you elaborate on "Once you get the query result of columns formulate your SELECT statement by using UPPER() dynamically". would it be ok to share an example? – dddela Nov 30 '22 at 18:52