Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Matthias Kallage asked how to copy a 300,000-row table's structure into a new empty table, e.g. CREATE TABLE AS SELECT with WHERE 1<0. Art S. Kagel posted a shell script piping dbschema output through awk into dbaccess to create the clone. Jim Lowry suggested dbschema then unload/load. Jiri Lisicky said SELECT ... WHERE 1<0 INTO TEMP works only for a temporary table. Vardan Aroustamian wondered about ALTER FRAGMENT. No outcome was stated.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Matthias Kallage — — source: Informix-list mailing list archive (1991-1998)
is it possible to copy a table (300.000 rows) into another table without the
rows
for example:
CREATE TABLE tab1AS SELECT * from tab2
WHERE 1<0
The goal is to duplicate a tabel with all columns but without any row
Matthias Kallage
↪ replying to Matthias Kallage
Art S. Kagel — — source: Informix-list mailing list archive (1991-1998)
Matthias Kallage wrote:
>
> is it possible to copy a table (300.000 rows) into another table without the
> rows
> for example:
> CREATE TABLE tab1> AS SELECT * from tab2
> WHERE 1<0
>
> The goal is to duplicate a tabel with all columns but without any row
Here is a shell script:
### BEGin script clone_table.sh
if [ $# -ne 3 ]; then
echo Usage: clone_table database existing_table new_tablename
exit 1
fi
Database=$1
TemplateTable=$2
ResultTable=$3
dbschema -d $Database -t $TemplateTable | awk "
/create table/{print \\"create table \\$ResultTable\\"; next}
{print $0'}" | dbaccess $Database -
### EOScript ###
Art S. Kagel
↪ replying to Matthias Kallage
Vardan Aroustamian — — source: Informix-list mailing list archive (1991-1998)
In article <7lfkvv$29$1@news02.btx.dtag.de>,
"Matthias Kallage" <mkallage@bigdutchman.de> wrote:
> is it possible to copy a table (300.000 rows) into another table
without the
> rows
> for example:
> CREATE TABLE tab1> AS SELECT * from tab2
> WHERE 1<0
>
> The goal is to duplicate a tabel with all columns but without any row
>
> Matthias Kallage
>
>
Can anybody check is it possible to implement with a couple of
ALTER FRAGMENT statements? Sorry, I'm unable to test it myself
right now.
Well, I know restrictions for alter fragment and you should have
dbspaces ready to play, but it's just interesting. Especially
when you trying to detach empty fragment?
Thanks
Vardan
--
Vardan Aroustamian
vaar@geocities.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
↪ replying to Art S. Kagel
jim lowry — — source: Informix-list mailing list archive (1991-1998)
Art S. Kagel wrote:
>
> Matthias Kallage wrote:
> >
> > is it possible to copy a table (300.000 rows) into another table without the
> > rows
> > for example:
> > CREATE TABLE tab1> > AS SELECT * from tab2
> > WHERE 1<0
> >
> > The goal is to duplicate a tabel with all columns but without any row
>
> Here is a shell script:
>
> ### BEGin script clone_table.sh
>
> if [ $# -ne 3 ]; then
> echo Usage: clone_table database existing_table new_tablename
> exit 1
> fi
>
> Database=$1
> TemplateTable=$2
> ResultTable=$3
>
> dbschema -d $Database -t $TemplateTable | awk "
> /create table/{print \\"create table \\$ResultTable\\"; next}
> {print $0'}" | dbaccess $Database ->
> ### EOScript ###
>
> Art S. Kagel
can you not...
dbscheama -t XXX -d XXX > bbb
unload then load ?
↪ replying to Matthias Kallage
Jiri Lisicky — — source: Informix-list mailing list archive (1991-1998)
On Thu, 1 Jul 1999 13:55:40 +0100, "Matthias Kallage"
<mkallage@bigdutchman.de> wrote:
>is it possible to copy a table (300.000 rows) into another table without the
>rows
>for example:
>CREATE TABLE tab1>AS SELECT * from tab2
>WHERE 1<0
>
>The goal is to duplicate a tabel with all columns but without any row
>
>Matthias Kallage
>
Only temporary table:
SELECT *
FROM tab2
WHERE 1<0
INTO TEMP tab1
--
Jiří Lisický ČD DATIS Olomouc
e-mail: lisicky@datis.cdrail.cz Nerudova 1
phone: +420-068-472-5496 Olomouc, Czech Republic
>>> čeština ISO-8859-2 Compatible <<<
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.