SELECT @cnt := COUNT(table_name)
FROM information_schema.tables
WHERE table_schema = 'TAA'
and table_name = 'Clients';
IF (@cnt > 0) THEN
INSERT INTO `ClientsBAK` SELECT * FROM `Clients`;
END IF;
I get a syntax error at IF(@cnt > 1) THEN error 1064
Create a stored procedure:
I think you also want
IF @cnt > 0instead ofIF @cnt > 1, so I changed that for you.