组成多个mysql脚本 [英] composing multiple mysql scripts

查看:56
本文介绍了组成多个mysql脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在复合脚本中包含其他mysql脚本?理想情况下,我不想为所包含的脚本创建存储过程...对于较大的项目,我希望按层次维护几个较小的脚本,然后根据需要进行组合...但是,现在,我很乐于学习如何包含其他脚本...

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...

推荐答案

source 是一个内置命令,您可以在MySQL客户端工具(用于执行SQL脚本的工具)中使用):

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

如果要在存储过程中或使用API​​执行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.

这篇关于组成多个mysql脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆