Re: Drop Primary Key
Posted in 2000
En Patrick Brosnan va escriure el dia 28 Jul 2000, a les 16:15:
> Hello
> I am trying to drop a primary key from a table (Informix 2000) with the
> procedure below. When I run it I get the message
> "Unable to find CONSTRAINT (prim_key)."
> Any thoughts ?
> Thanks
> Patrick
>
>
> CREATE PROCEDURE DropSpvxDestPrimKey()>
> DEFINE prim_key VARCHAR(25);
>
> select constrname into prim_key from sysconstraints where constrtype =
> 'P'
> and tabid = (select tabid from systables where tabname =
> 'fv_spvx_dest_2');
>
> alter table fv_spvx_dest_2 drop constraint prim_key;>
> END PROCEDURE;
>
>
SPL don't support dynamic SQL
use alter table fv_spvx_dest_2 drop constraint _primary_key_real_name_not_a_variable_name
I hope this helps!
---------------------------------------
Isidre PONS ROCA
BASE - Gesti' d'Ingressos Locals
(Diputacio de Tarragona)
Servei de Sistemes d'Informacio
Av President Lluis Companys 12-C
43005 - Tarragona
SPAIN
Tel # +34 977 236731
Fax # +34 977 227302
http://www.altanet.org
ipons@dtgna.altanet.org
---------------------------------------