Tag Info

New answers tagged

2

Thanks everyone, but I'm going to use these FUCNTIONs that I made. One FUNCTION to extract letters and one to extract numbers (even decimals). Letters: USE `test`; DROP function IF EXISTS `alpha`; DELIMITER $$ USE `test`$$ CREATE DEFINER=`root`@`localhost` FUNCTION `alpha`( vStr CHAR(75)) RETURNS char(32) CHARSET latin1 BEGIN DECLARE vInd, vLen ...


3

I have a rather ugly approach that will strip alphanumeric characters from a user variable STRIPPING ALPHAS SET @st='r1+o2l-3a4*n5d6o7'; SELECT (@st:=REPLACE(@st,ch,'')) FROM ( SELECT (x*10+y) ndx,SUBSTR(chars,x*10+y,1) ch FROM (SELECT 'abcdefghijklmnopqrstuvwxyz' chars) L, (SELECT 0 x UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4 ...


0

I have the same requirement in one of my project so i have used : SELECT CASE WHEN floor(substr(name, 3,1)) > 0 THEN CONCAT_WS('-', SUBSTRING(name, 1, 2), SUBSTRING(name, 3, LENGTH(name))) ELSE CONCAT_WS('-', SUBSTRING(name, 1, 3), SUBSTRING(name, 4, LENGTH(name))) END AS new_name FROM test It might be help you for your solutions



Top 50 recent answers are included