Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

composing multiple mysql scripts

Is it possible to INCLUDE other mysql scripts in a composite script? Ideally I do not want to create a stored procedure for the included scripts... For larger projects I would like to maintain several smaller scripts hierarchically and then compose them as required... But for now, I'd be happy to just learn how to include other scripts...

like image 741
badkya Avatar asked Nov 23 '25 22:11

badkya


1 Answers

source is a builtin command you can use in the MySQL client tool (which is what you're using to execute the SQL script):

mysql> source otherfile.sql

If you're executing SQL in a stored procedure or with an API, you should know that MySQL client builtins work only in the MySQL client.

like image 125
Bill Karwin Avatar answered Nov 26 '25 11:11

Bill Karwin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!