Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

ALPHANUM datatype contains non-alphanumeric character like @#$&*

Hi All,

I use ALPHANUM datatype in one table with 127 size. As per definition in Developer guide

"ALPHANUM(n) data type specifies a variable-length character string which contains alphanumeric characters"

Example :

insert into "SOMNATH"."aadata" values(to_ALPHANUM ('!@#$%')) ;

insert into "SOMNATH"."aadata" values(')(*&!@#$%') ;

Above statement executed successfully. So HANA cannot check alphanumeric char. at the time of insertion or any other reason?

Message was edited by: Tom Flanagan

Tags:
Former Member
Former Member replied

Hi Somnath,

The below is the difference between varchar, nvarchar and alphanum:

Varchar can have a length from 1 to 5000 and stores data as 8 bit ASCII character string.

NVarchar can have a length from 1 to 5000 and stores data as UTF -16 Unicode character string.

Alphanum can have length from 1 to 127. Additionally if an alphanum variable contains pure numeric value, it will be represented with leading zeroes.

I would prefer to use varchar to store textbox name, label, username etc. as it takes less space.

Can you please let know whether you are trying/want to prevent values with special characters not to be stored in the variable.

In that case, i would suggest you to write a procedure inside which you can check whether there are special characters in the input value, if special characters exist throw and error, if the input value is of correct format then insert it into a table.

The datatype by default will not prevent you from storing special characters.

But in the case of  integer data type, it will not allow you to enter any other value apart from number.

Thanks and Regards,

M.N.Adinarayanan

1 View this answer in context
Not what you were looking for? View more on this topic or Ask a question