Thread: How can I Delete/Alter Unique Constraint

How can I Delete/Alter Unique Constraint

From
"shreedhar"
Date:
Hi All,

How can I delete Unique Constraint/ Alter Unique Constraint.

example

tblStudent
=======
stdid
stdname
classid

previously I gave stdname as UNIQUE
but I need to alter it as UNIQUE (stdname,classid)

Just it is an example, donot ask why not more than one student with same can
exist in one class.

Thanks alot,

With Best Regards,
Sreedhar Bhaskararaju 1,2nd Main Road, KottuGardens, Chennai - 600 085 Ph :
4475111 Email : shreedhar@lucidindia.net


Re: How can I Delete/Alter Unique Constraint

From
Bhuvan A
Date:
On Thu, 29 Aug 2002, shreedhar wrote:

> Hi All,
>
> How can I delete Unique Constraint/ Alter Unique Constraint.
>
> example
>
> tblStudent
> =======
> stdid
> stdname
> classid
>
> previously I gave stdname as UNIQUE
> but I need to alter it as UNIQUE (stdname,classid)
>

It is this way. Try
$ drop index stdname_index_name;
DROP
$ create unique index stdname_classid_index_name on tblStudent (stdname,
class_id);
CREATE

If you are unaware of stdname_index_name try
$ \d pg_indexes

for details.

regards,
bhuvaneswaran