sql server - Insert into sql Max +1 only numbers (prevent characters) -


i'm using code

(select (max(code)   +1  isnumeric([code]) = 1) 

i want max +1 numbers of column preventing characters characters.

note: question tagged mysql when answer posted.

you can use substring_index() split values , re-unite them:

(select concat(substring_index(max(code), '-', 1), '-',                substring_index(max(code), '-', -1) + 1               )   . . .  code '%new-1%' ) 

this assumes wildcards not have hyphens in them, , values after "1" numbers.

also, doesn't pad number zeroes, idea such codes -- ensures same length , sort correctly.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -