if statement - SQL IF value LIKE -


i’m new sql, apologies menial question.

i’m storing staff numbers in format similar ‘e01, e02 .. e98, e99’

i have procedure input values employee table want carried out if provided value staff number field same format shown above.

i have tried ..

create procedure new_staff (in e_id employee ids,                 ….,                 ….,etc) begin if e_id not 'e__'    /* fail*/  else /* insert record*/ end 

i tested using value ‘e9999’ , didn't recognise error, instead took value 'e99'. appreciated.

many thanks

-edit- sorry - clear things up. i'm using sql anywhere , want maximum possible employee id e99. logic using e__ (two underscores) make impossible input e100 or higher.

edit:

try other way round

if e_id 'e__'          /* insert record*/   else      /* fail*/ end 

if want wildcards numbers, try one:

if e_id 'e[0-9][0-9]'          /* insert record*/   else      /* fail*/ end 

for further information on sql-wildcards visit link.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -