windows - Pass parameter from Batch file to MYSQL script -


I believe this question has never been asked before, it is necessary! I'm working on a batch file that needs to run some SQL commands. All the tutorials do not work by stating that (referring to this link: that someone will undoubtedly mention)! I have tried other posts on this site and still nothing is working.

The way I see it, I can see it in two ways: 1. Either my basic Learn how to call MYSQL script and specify a parameter. 2. A similar "USE; command that works in batches

My batch file is still:

 : Start @ ECO off: set_user set USR code = 0 MyScall-U Root SET @usrcode = '0'; \. Caller SQL  

Simply put, 'myrmode' pass mysql script 'caller.sql', which looks like this Is:

  USE `my_db`; call gather_mahity (@rrcode);  

I know there is a whole other topic for joining the function , But assume that The process is working properly. I can not get my parameter from my batch from MYSQL.

Ideally I call 'USE' and 'call' command in my batch file, but nothing I can not find the one who wants to select the database in the batch before calling me my process. When I tried the above link which claims a simple command line entry and you are off to the race, but this is not the case

Kiss Would be greatly appreciated to help.

This will work;

  echo SET @usrCode = '0'; & Gt; Params.sql type params.sql caller.sql | Mysql -u root dbname  

Comments