I have a remote database that I connect to and run some simple select statements to retrieve data. I want to automate this process using the sqlcmd. Currently, I use MySQL Query Browser to connect to the db with the following settings:
Server Host: xx.xx.xxx.xx (ip address)
Default Schema: <schema_name>
From there I can execute what I need to and get my data.
I have tried the following cmd and it does not work:
Sqlcmd -Stcp:<IP Address>\<schema_name>:3306 -U<username> -P<password> -Q"SELECT first_name, last_name, address1, address2, city, state, zip, regular_address, email, can_email FROM <table_name> WHERE DateDiff(d,DatePosted, GetDate())=0;" -o \\<server>\transfer\cr.csv -h-1 -s"," -w 700
*In the command above I substituted the actual <ip address> from the MySQL connection as well as the <schema_name> from the connection properties.
Any help would be greatly appreciated!!