Re: How to dump table contents as SQL statements?
From: Andreas Michler <Andreas.Michler_at_adicom.de>
Date: Wed, 26 Jan 2000 08:10:00 +0100
Message-ID: <388E9DC8.7ED23F86_at_adicom.de>
You must remove the first two and the last line.
Date: Wed, 26 Jan 2000 08:10:00 +0100
Message-ID: <388E9DC8.7ED23F86_at_adicom.de>
try the following
spool xx
select 'insert into xx (field1,field2,field3) values
('||field1||','||field2||','||field3||');' from xx;
spool off
after this you have a file called xx.log with the following statement:
insert into xx(field1,field2,field3) values(1,2,3); insert into xx(field1,field2,field3) values(1,2,4); insert into xx(field1,field2,field3) values(1,2,5); insert into xx(field1,field2,field3) values(1,2,6); insert into xx(field1,field2,field3) values(1,2,7);....
You must remove the first two and the last line.
This works only with numeric fields.
With char,varchar or datefield you must put the char ' into your values
clause.
Gopal Santhanam wrote:
> Hi,
>
> How do you dump the data contents of a table as a series of sql insert
> statements? I'd like to generate a sql script file that can be later
> loaded into an empty incarnation of the same table.
>
> I know there is such an animal in for MySQL.
>
> Gopal
-- ------------------------------------- [Quoted] ADICOM Informatik GmbH Andreas Michler Wiesfleckenstr. 34 72336 Balingen Tel: 07433/9977-57,Fax: -90 E-Mail: Andreas.Michler_at_adicom.de http:\\www.adicom.de -------------------------------------Received on Wed Jan 26 2000 - 08:10:00 CET