Обсуждение: How can I Delete/Alter Unique Constraint

Поиск
Список
Период
Сортировка

How can I Delete/Alter Unique Constraint

От
"shreedhar"
Дата:
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

От
Bhuvan A
Дата:
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