i've got an alter table statement which i know works
ALTER TABLE `tbl_dynamic_page_trash`
ADD CONSTRAINT `KEY_sites11` FOREIGN KEY (`FK_sites`) REFERENCES `tbl_sites` (`PK_sites`) ON DELETE CASCADE ON UPDATE NO ACTION;
but i require to have /* wrap around the statement because .net doesn't like the statement without /*
like the following,
/*!40000 ALTER TABLE `tbl_dynamic_page_trash`
ADD CONSTRAINT `KEY_sites11` FOREIGN KEY (`FK_sites`) REFERENCES `tbl_sites` (`PK_sites`) ON DELETE CASCADE ON UPDATE NO ACTION*/;
the statement runs but doesn't alter my table, any reason why?
hi, the table is not getting altered because when u try to execute the query in /*....*/, the sql recognises it as a comment and hence it wont execute that....it wont show any error thatz y u r saying that the statement is running...actually it is not running
and not getting executed...
if there is any other opinion then definitely i would love to hear them.
lindows
Member
168 Points
354 Posts
How to Alter Table with /*
Feb 25, 2010 12:07 AM|LINK
i've got an alter table statement which i know works
ALTER TABLE `tbl_dynamic_page_trash`
ADD CONSTRAINT `KEY_sites11` FOREIGN KEY (`FK_sites`) REFERENCES `tbl_sites` (`PK_sites`) ON DELETE CASCADE ON UPDATE NO ACTION;
but i require to have /* wrap around the statement because .net doesn't like the statement without /*
like the following,
/*!40000 ALTER TABLE `tbl_dynamic_page_trash`
ADD CONSTRAINT `KEY_sites11` FOREIGN KEY (`FK_sites`) REFERENCES `tbl_sites` (`PK_sites`) ON DELETE CASCADE ON UPDATE NO ACTION*/;
the statement runs but doesn't alter my table, any reason why?
renjithrajan...
Participant
1305 Points
367 Posts
Re: How to Alter Table with /*
Feb 25, 2010 04:31 AM|LINK
Renjith
dotNET developer
Plz mark as answer if it helped u in any way.
april_123456
Participant
775 Points
246 Posts
Re: How to Alter Table with /*
Mar 12, 2010 01:32 AM|LINK
Do you know what the /* */ wrap means in sql?
The statement in the /* */ wrap won't runn in the executing.
-----------------------------
April
Free Live Chat Software