Reputation: 3
I have codes in a text column, for example, e12312312 E123123123 need to write sql query who make every value in a column with capital E my database is postgresql
Upvotes: 0
Views: 567
Reputation: 222482
You can use Postgres string function initcap()
to turn the first character of a string to upper case and the rest of the string to lower case : since the rest of your strings is made of digits only, this should work:
select initcap('e12312312')
If your string may contain other upper case letters than you do not want to lower, then you can use left()
, right()
and upper()
:
select upper(left('e12312312ABC', 1)) || right('e12312312ABC', -1);
Upvotes: 1