| | |
Shell script to select and insert values from mysql.
Please support our Shell Scripting advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2009
Posts: 3
Reputation:
Solved Threads: 0
Hi,
I am familiar with shell script but not really have much experience. I am looking into a shell script that would do this
I have 2 tables
TableA
id name interest
----------------------------------------
TableB
id name
I have to create a shell script which copies all the id,name values from TableA and inserts them in TableB.
Is this possible? Any help is appreciated.
thanks
I am familiar with shell script but not really have much experience. I am looking into a shell script that would do this
I have 2 tables
TableA
id name interest
----------------------------------------
TableB
id name
I have to create a shell script which copies all the id,name values from TableA and inserts them in TableB.
Is this possible? Any help is appreciated.
thanks
•
•
Join Date: Aug 2007
Posts: 165
Reputation:
Solved Threads: 18
•
•
•
•
... I have to create a shell script which copies all the id,name values from TableA and inserts them in TableB.
Is this possible? Any help is appreciated.
thanks
And it's really trivial.You could try something like:
Shell Scripting Syntax (Toggle Plain Text)
mysql -u username -e 'insert into TableB select col1,col2 from TableA;'
•
•
Join Date: Aug 2007
Posts: 165
Reputation:
Solved Threads: 18
•
•
•
•
thank you I got that. its working fine. How do I check if any error occurred during execution. If an error occurred I would like to do a different operation.
Shell Scripting Syntax (Toggle Plain Text)
mysql -u ... if [ $? -eq 0 ]; then echo "Success" else echo "Failure" fi
![]() |
Similar Threads
- Help with automatic update problem and more (Viruses, Spyware and other Nasties)
- submiting info into a database for retrieval! (PHP)
Other Threads in the Shell Scripting Forum
- Previous Thread: A second bash to auto-run as non-root user
- Next Thread: Recommended books for mastering Windows Scripting?
| Thread Tools | Search this Thread |
Tag cloud for Shell Scripting





