How to count the "number of character"?

Analytics

How to count the "number of character"?

Dear Who Know How,

Let say I have a table as below:
*********************************
PRTY_ID_NUM
L597921
761212-06-5364
*********************************

Can I use SQL to count the number of character for each variable?

The Result should be:
L597921=7
761212-06-5364=14

Many Thanks in Advance. ^_^
2 REPLIES

Re: How to count the "number of character"?

Hi Benjamin,

You can use Character_length() function to count the no of characters.

For your example use the following query:

select PRTY_ID_NUM, character_length(PRTY_ID_NUM) from table_name;

Result will be:
PRTY_ID_NUM -- character_length(PRTY_ID_NUM)
L597921 -- 7
761212-06-5364 -- 14

Regards,
Balamurugan

Re: How to count the "number of character"?

Dear Balamurugan,

Thank you very much!

Cheer! ^_^