MySQL Forums
Forum List  »  Triggers

Re: Trigger to reset auto increment after the table empty
Posted by: Rusdy Perkasa
Date: April 25, 2014 02:49AM

already try this trigger

BEGIN
DECLARE var INT;
SET @var = (SELECT COUNT(ID) FROM MASTERBARANG LIMIT 1);
IF @var IS NULL THEN
ALTER TABLE MASTERBARANG SET AUTO_INCREMENT=1;
END;
END

but it shows error syntax on ALTER TABLE MASTERBARANG SET AUTO_INCREMENT=1;

thx for reply

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Trigger to reset auto increment after the table empty
1663
April 25, 2014 02:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.