× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I have an existing permanent SQL-created file. I want to create another
file in the same library that has the same exact structure (fields, keys,
constraints, etc) and am having difficulty doing so. This new file is not a
work or temporary file, it is permanent. I do not want to rename all the
141 fields in the DDL as the 2 files will _always_ have the same structure.

I tried this:

CREATE TABLE JEFF/newfile
LIKE JEFF/oldfile
PRIMARY KEY ( ITNBR ) ,
CONSTRAINT imPrcBkSeqUK UNIQUE (MBGROP , MBSBGP , MBLINE)
NOT VOLATILE
RCDFMT MBRECORD ;

But it balked at the PRIMARY KEY.

So I did this:

CREATE TABLE JEFF/newfile
LIKE JEFF/oldfile
NOT VOLATILE
RCDFMT MBRECORD ;

Which worked, but now I need to get all 15+ constraints in, including
primary key, unique keys, foreign keys, and check. Do I need a separate
ALTER TABLE for each and every one of these? I was hoping to combine them
into 1 ALTER TABLE, but can't seem to determine the syntax.

The actual ideal would be something like:

CREATE TABLE JEFF/newfile
LIKE JEFF/oldfile
WITH CONSTRAINTS
NOT VOLATILE
RCDFMT MBRECORD ;

But I don't see any examples like that anywhere <g>.

Any help appreciated.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.