Mysql: How to call sql script file from other sql script file?

Problem :

Suppose I have wrote script Table_ABC.sql which creates table ABC. I have created many such scripts for each of required tables. Now i want to write a script that call all of these script files in a sequence so basically I want another script file createTables.sql. Mysql provides option to execute a script file from "mysql" shell application but could find some command like exec c:/myscripts/mytable.sql. Please tell me if there is any command that can be written in sql script itself to call other one in latest mysql versions or alternative for same.


Solution :

You can use source command. So your script will be something like:

use your_db;
source script/s1.sql;
source script/s2.sql;
-- so on, so forth

Mysql Tutorials

Mysql Howto..

how to set triggers with the dynamic values in mysql?

how to execute the query that include date function(MySQL)

How to use SELECT INTO with static values included?

How do I link a MySQL table's columns to columns is other tables?

how to pass a mysql row variable with a form

PHP MySQL Unexplained Null Values-How To Insert all Values In one Record?

How to create a always running PHP background script to clean up particular rows in mySql DB?

How to backup more than 1 database in once in MYSQL using command line on ubuntu server 10.10?

How to direct create a multidimensional array from a mysql query using php?

How to give a unique name to elements of foreach outside of the loop?

how to convert mysql database to class diagram

How to use nested SELECTs in Mysql with LIKE?

How can I prevent this script from being freely accessed?

How to group on PHP MySQL JOIN results?

how to calculate time difference between two dates? - MySql

How to access mysql of my Webhost from Command Promt

How do I send these Jquery Variables off to Mysql via php?

How do I model this MySQL table as a Super ColumnFamily in Cassandra?

How to set the value of a column to -1 (minus one) without peforming the operation

How to select a random sample of records from MySQL?

How to improve performance for REGEXP string matching in MySQL?

How to get the right select/option selected from mysql-db

Mysql-PHP how to separate long string row into different columns?

How to check the date in 'YYYY-MM-DD' format with the date present in 'Unix Time stamp' format in PHP?

how to solve date matching in php mysql website?

How to retreive records from past weeks in django

How to lock mysql tables in php

Need to update my single user app database to allow multiple users, how to modify database schema?

How to create a table in mysql with a random name?

How to store many rows of long strings in mySQL