1

Lets I have a table named myTable in mysql with Three field

1. id int autoincrement
2. product_id varchar(20) not null
3. product_name varchar(200) not null

Now I want to keep data in product_id and product_name without white-space.

1
  • What did you try yourself? Feb 24 '14 at 10:33
3

Yes, one way to do this will be to create a insert trigger on the table...can trim the values before inserting into the table ..

2
  • any specific reason to use trigger ? Feb 24 '14 at 15:07
  • whenever new records are inserted or any existing records are updated in the table ,it will ensure that only valid data (without white-space in your case) is entered into the table Mar 7 '14 at 10:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.