If you want to update the existing table (where m_id is int and auto increment) then you can use this(before update query you need to change datatype of m_id)
ALTER TABLE merchant
MODIFY COLUMN id varchar(50);
then use update query
UPDATE merchant set m_id=CONCAT("SDMP",m_id);
OR
If you want to insert m_id as SDMP1, SDMP2 autoincrement then you can use this
- Get Last ID
- Get the INT part within the string
- Increment the value
- Concatenate
- Save to DB
moreinfo
INSERT INTO merchant
SELECT CONCAT("SDMP",SUBSTRING(m_id,5)+1),"abc4"
FROM merchant order by m_id desc limit 1;
NOTE: if no row in the DB then manually insert SDMP1 as the first row in DB
OR
Keep thing simple, you keep m_id as int auto_increment
in DB and while retrieving data from DB concat with SDMP CONCAT("SDMP",m_id)
and while searching in DB take integer part from gridview of m_id column