Hello All,
Problem i am facing is , i need to add some zero's to the user input. if user inputs 012345, i need to save 00012345 (total 8 characters), which can be done by
but this code breaks when user enter's any string with alphanumeric characters. Is their any way i can do like if input has any alphanumeric character in it, ignore this replace query else do this?
just for info: whole data is database is stored in varchar(8), which can be integer value with leading 0 if less than 8 characters to make it to 8 characters OR some varchar value.
Any help will be appreciated
Regards
Jay
Problem i am facing is , i need to add some zero's to the user input. if user inputs 012345, i need to save 00012345 (total 8 characters), which can be done by
Code:
CAST(REPLACE(STR(VarcharValue,8),' ','0') as Varchar(8))
just for info: whole data is database is stored in varchar(8), which can be integer value with leading 0 if less than 8 characters to make it to 8 characters OR some varchar value.
Any help will be appreciated
Regards
Jay
Comment