Re: problem with drop constraints
Posted in 2000
hi !
This gives me a proper command to run, but it doesnt run by itself.
i get it on the dbaccess prompt and then i have to copy paste that to
another sql and run it.
Means, some manual intervention has to be there.
we have to run this script a 'n' number of times.
sowant to remove the manual intervention.
but the restriction, it has to be done thru sql in dbaccess only.
so there is any other way for that ?
thanks,
nayan jain !
On Wed, 19 Apr 2000, Obnoxio The Clown wrote:
> From: nayan jain <nayan.jain@tatainfotech.com>
> >
> >Is there any way that i can drop a constraints dynamically ?
> >
> >like this ?
> >
> >alter table sam_user
> >( drop constraints ( select constrname from sysconstraints
> >where tabid = (
> >select tabid from systables
> >where tabname = "sam_user")
> >and constrtype = "R"
> >and idxname = (
> >select idxname from sysindexes
> >where tabid = (select tabid from systables where tabname = "sam_user")
> >and idxtype = "D"
> >and part1 = 5)
> > )
> >)> >
> >i have to write specifically "drop constraints r1323_12272"
>
> Why don't you write an SQL like:
>
> SELECT "alter table sam_user( drop constraint " ||
> constrname || ");"
> from sysconstraints c, systables t, sysindexes i
> where c.tabid = t.tabid
> and tabname = "sam_user"
> and constrtype = "R"
> and i.tabid = t.tabid
> and idxtype = "D"
> and part1 = 5
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"For most gulls, it is not flying that matters, but eating
For this gull,though, it was not eating that mattered but flight."
-- Jonathan Livingston Seagull