Re: [Dev] Delete an unnamed FK from H2, MYSQL, MSSQL, Oracle and PostgreSQL

2015-05-19 Thread Madusanka Premaratne
Hi all, Finally I cam up with the following solution for H2, because it is not possible to retrieve and in a single query/sub query. SELECT DISTINCT constraint_name FROM information_schema.constraints WHERE table_name = 'YOUR_TABLE_NAME'; then use the constraint_name and build the query to alter

[Dev] Delete an unnamed FK from H2, MYSQL, MSSQL, Oracle and PostgreSQL

2015-05-18 Thread Madusanka Premaratne
Hi Devs, I need to perform a SQL table alteration to remove a foreign key which is unnamed. As per my findings it is possible to find the automatically assigned constraint name in mysql by using *information_schema* table [1] Also it is possible in mssql[2] and oracle[3] [1] -

Re: [Dev] Delete an unnamed FK from H2, MYSQL, MSSQL, Oracle and PostgreSQL

2015-05-18 Thread Madhuranga Bandara
Hi Madushanka, This article [1] provides the step by step explanation on how to solve this kind of issue. Hope this is helpful. [1] http://www.briskbee.com/posts/changing_unnamed_constraints_in_play_ *Madhuranga Sampath Bandara* Software Engineer WSO2, Inc.;http://wso2.com/

Re: [Dev] Delete an unnamed FK from H2, MYSQL, MSSQL, Oracle and PostgreSQL

2015-05-18 Thread Thusitha Thilina Dayaratne
Hi Madusanka, Look in to the following stackoverflow question[1]. This might also help you. https://groups.google.com/forum/?hl=en#!searchin/h2-database/unnamed/h2-database/Lb4QdF9jkOc/2uw1pA7i0T8J [1] - http://stackoverflow.com/questions/10008476/dropping-unique-constraint-for-column-in-h2 On

Re: [Dev] Delete an unnamed FK from H2, MYSQL, MSSQL, Oracle and PostgreSQL

2015-05-18 Thread Madusanka Premaratne
Hi Thusitha, I tried the subquery approach before but it does not get the identifier properly from the sub query. When I run the subquery only, it shows me the constraint name. But when it comes to the main query, it does not get the identifier. Hi Madhuranga, Thanks for the reply, but the