execute sql file from command line code example
Example 1: execute mysql file
mysql -u yourusername -p yourpassword yourdatabase < text_file
Example 2: tsql cmd exec script from file
#Integrated Security
sqlcmd -S Serverinstance -E -i import_file.sql
#UserName and Password
sqlcmd -S <server Name> -U sa -P sapassword -i inputquery_file_name -o outputfile_name