Hello Martijn
thanks so much for your reply

pls read this carefully

ok

for instance

i already know how use mysqldump,
so i can get A.sql , something like this

insert into person(id,name,age,sex ) VALUES (01, jesus, 33, male ),
insert into person(id,name,age,sex ) VALUES (02, michael, 17, male),
insert into person(id,name,age,sex ) VALUES (03, lucia, 18, female),
....


the point i need generate a B.sql (from A.sql or other way)
something like this

UPDATE person name='jesus', age='33' WHERE id='01',
UPDATE person name='michael', age='17' WHERE id='02',
UPDATE person name='lucia', age='18' WHERE id='03',
....

if you can see in my "desired" B.sql
for each row from A.sql (insert) i have a match row in B.sql (update)
see 2 importants things
1: one column is missing (sex)
   thats the reason that i need create this B.sql 
   with my desired columns to update
2: the information in update statements are the same like to A.sql, 
   but i am free to change some row to update

in other words i need something like a template (B.sql) to update 
any "update statment" and the "desired columns"

i hope you see my point now

thanks in advanced



Martijn van den Burg wrote:
> 
> Hi,
> 
>> if i have for example
>> a simple table call person
>> 
>> with 'id' and 'name' how columns
>> 
>> i can do a backup and get some file (A.sql)
>> with all the inserts statements
>> 
>> here, all fine
>> 
>> but
>> how i can do this?
> 
> Have a look at the 'mysqldump' command line utility.
> It goes something like 'mysqldump -u <user> -p <password> -h <host>
> <database> [<table>] > output.sql'.
> This will generate a text file with SQL statements that you can use to
> recreate the table.
> 
> See http://dev.mysql.com/doc/refman/5.0/en/mysqldump.html.
> 
>> for each insert statement generated in A.sql
>> create a new B.sql, with update statements
>> 
>> its possible do this?
> 
> You could do this by editting the 'output.sql' file, changing the table
> name from A to B.
> Or you could execute the following SQL: 'CREATE TABLE B SELECT * FROM
> A'. 
> 
> See http://dev.mysql.com/doc/refman/5.0/en/create-table.html.
> 
>> even worst, if a have a table with 20 columns
>> i need the way to generate the same B.sql
>> but with my desired columns to update
> 
> I am not sure I understand your question, but you could make a database
> export using 'mysqldump', then alter the statements in the resulting
> output file to create the tables you need...
> 
> 
> HTH,
> 
> Martijn
> 
> -- 
> The information contained in this communication and any attachments is
> confidential and may be privileged, and is for the sole use of the
> intended recipient(s). Any unauthorized review, use, disclosure or
> distribution is prohibited.  Unless explicitly stated otherwise in the
> body of this communication or the attachment thereto (if any), the
> information is provided on an AS-IS basis without any express or implied
> warranties or liabilities.  To the extent you are relying on this
> information, you are doing so at your own risk.   If you are not the
> intended recipient, please notify the sender immediately by replying to
> this message and destroy all copies of this message and any attachments.
> ASML is neither liable for the proper and complete transmission of the
> information contained in this communication, nor for any delay in its
> receipt. 
> 
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Some-way-tool-to-do-this-with-database-scripts-backups-tp16496072p16524400.html
Sent from the MySQL - General mailing list archive at Nabble.com.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to