In a .bat file, I am trying to get the count from a database table and trying to assign it to a variable. But echo of the variable shows that the variable is getting assigned to the statement string value instead of the count. When I execute only the statement in command prompt I am able to see the count, which means the statement is correct. Need help in assigning this count to a variable.
Code Snippet:
SET x='mysql -uroot -pmysql -N testdatabase -e"select count(*) from test"'
echo "x :" %x%