Steve,

Sorry.  Maybe this syntax will work:

ALTER TABLE CHARGES DROP CONSTRAINT &vConstraintName

Bill

Steve Breen wrote:
Bill,

The following is the reason I am confused.

I have tried all this and still keep getting the same results. Originally I
pasted your code into my file and ran in and got the following:

-ERROR- Invalid constraint identifier. (2743)

The current code is:

SELECT sys_index_name INTO vConstraintName +
  FROM sys_indexes     +
  WHERE sys_table_id = +
   (sel sys_table_id from sys_tables where sys_table_name = 'Charges') +
AND sys_column_name = 'chargetype' +
and sys_foreign_key <> 0

ALTER TABLE CHARGES DROP CONSTRAINT .vConstraintName

Still Get:

-ERROR- Invalid constraint identifier. (2743)

The folling are some R prompt results:


R>sel sys_index_name into vConstraintName from sys_indexes where sys_table_id+ +> = (sel sys_table_id from sys_tables where sys_table_name = 'Charges') and + +>sys_column_name = 'chargetype' and sys_foreign_key <> 0 R>show var .vconstraintname -ERROR- Variable #60 is not defined. ( 20) R>run archive8.rmd -ERROR- deltable is an undefined table. (2038) R>show var .vconstraintname -ERROR- Variable #60 is not defined. ( 20) R>run archive8.rmd -ERROR- deltable is an undefined table. (2038) -ERROR- Invalid constraint identifier. (2743) R>show var vconstraintname #60 R>ALTER TABLE CHARGES DROP CONSTRAINT vConstraintName -ERROR- Invalid constraint identifier. (2743) R>ALTER TABLE CHARGES DROP CONSTRAINT .vConstraintName -ERROR- Invalid constraint identifier. (2743) R>



-----Original Message-----
From: Bill Downall [mailto:[EMAIL PROTECTED]
Sent: Friday, April 29, 2005 6:16 PM
To: [email protected]
Subject: [RBG7-L] - Re: [No Subject]


Steve,

the syntax of SHOW VAR "expects" a variable after the word var. You don't need to "dot" it. In fact, when you "dot" it, R:Base thinks you want the variable NAMED whatever the current value in the variable is.

You typed:
        SHOW VAR .vconstraintname

If you:
        SHOW VAR vconstraintname

You will see '#60' is the name of the constraint.

Then all you have to do is:

        ALTER TABLE Charges DROP CONSTRAINT #60

(or, in a program:)

        ALTER TABLE Charges DROP CONSTRAINT .vConstraintname

Bill

Steve Breen wrote:


Bill,

I finally worked it down to this.

What do you think.

R>sel sys_index_name into vConstraintName from sys_indexes where sys_table_id +
= (sel sys_table_id from sys_tables where sys_table_name = 'Charges') and

+

sys_column_name = 'chargetype' and sys_foreign_key <> 0
R>show var .vconstraintname
-ERROR- Variable #60 is not defined. (  20)



Stephen Breen

CDI Services, Inc.

<http://www.911roadrepair.com>










Reply via email to