Thursday, 15 March 2012

mysql - ADD CONSTRAINT IF NOT EXISTS doesn't work for me -



mysql - ADD CONSTRAINT IF NOT EXISTS doesn't work for me -

i'm trying test this solution of add together constraint if not exists, error code :

if not exists (select null information_schema.table_constraints constraint_schema = 'mydatabase' , constraint_name = 'tb_uq') alter table `scrape_xpaths` add together constraint `tb_uq` unique (`linkcaption`); end if

i check syntax error.

also doesn't work:

if not exists (select null information_schema.table_constraints) end if

same error.

constraint name 'tb_uq' exists because commands :

select null information_schema.table_constraints select * information_schema.table_constraints

work , homecoming constraints , tb_uq 1 of them. doing wrong?

this how add together constraint first time. sec time fails of course of study :

alter table `mydatabase`.tablename add together constraint tb_uq unique (linkcaption);

also code below fails same error :

if (true) begin end else begin end

mysql

No comments:

Post a Comment