Update particular column with specific prefix
update tablename set ColumnName= concat('prefix',ColumnName);
Update particular column with specific sufix
update tablename set ColumnName= concat(ColumnName,'sufix');
Remove prefix from any column in predefine char
UPDATE tablename SET ColumnName = SUBSTRING(ColumnName,prefixLength) WHERE ColumnName RLIKE '^prefix';
Remove sufix from any column in predefine char
UPDATE tablename SET ColumnName = SUBSTRING(ColumnName,sufixLength) WHERE ColumnName LLIKE '^sufix';
Example:
Below query update the vLongId field with "-" prefix;
update TableName set vLongId = concat('-',vLongId );
Below query update the vLongId field with "-" prefix;
UPDATE TableName SET vLongId = SUBSTRING(vLongId ,2) WHERE vLongId RLIKE '^-';
update tablename set ColumnName= concat('prefix',ColumnName);
Update particular column with specific sufix
update tablename set ColumnName= concat(ColumnName,'sufix');
Remove prefix from any column in predefine char
UPDATE tablename SET ColumnName = SUBSTRING(ColumnName,prefixLength) WHERE ColumnName RLIKE '^prefix';
Remove sufix from any column in predefine char
UPDATE tablename SET ColumnName = SUBSTRING(ColumnName,sufixLength) WHERE ColumnName LLIKE '^sufix';
Example:
Below query update the vLongId field with "-" prefix;
update TableName set vLongId = concat('-',vLongId );
Below query update the vLongId field with "-" prefix;
UPDATE TableName SET vLongId = SUBSTRING(vLongId ,2) WHERE vLongId RLIKE '^-';
No comments:
Post a Comment