Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: find primary key with table name

Re: find primary key with table name

From: Steve Treesh <streesh_at_knology.net>
Date: Thu, 4 Jan 2007 19:01:38 -0600
Message-ID: <a12f9$459da373$18d678b8$21490@KNOLOGY.NET>

Steve

"Jean-Luc M." <alphomega_at_free.fr> wrote in message news:mn.12787d71e3110dcb.28556_at_free.fr...
> Hi,
>
> I need to translate the T-SQL code :
>
> SELECT
> @PK_NAME = so.name
> FROM
> sysobjects so JOIN sysconstraints sc ON so.id = sc.constid
> WHERE
> object_name(so.parent_obj) = @TABLE AND so.xtype = 'PK'
>
> -- Si on a trouvé la PK on la supprime
> IF @PK_NAME IS NOT NULL
> EXECUTE('alter table [' + @TABLE + '] DROP CONSTRAINT ' + @PK_NAME)
> ;
>
> in PL-SQL
>
> How to find the primary key for a table name with PL-SQL and delete it
> ?
>
> Thanks and happy new year !
>
> Jean-Luc !
>
> --
> Jean-Luc M.
>

> Received on Thu Jan 04 2007 - 19:01:38 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US