When you install InTouch, make sure you install the SQL Access Manager. Once it is installed, review the SQL Access Manager's guide. A link should be found under Programs>Wonderware>Books. In short, you will need to:
1. Create a bind list
2. Open a connection to your database using SQLConnect statement(recommend doing this in a startup script)
3. Define a "where" expression(a criteria statement for your query if needed)
4. Use a SQLSelect statement to query your database
5. Be sure to use a SQLEnd statement after every SQLSelect to release allocated memory.
6. Be sure to include a SQLDisconnect statement in your shutdown script.
You will need to review the manual to fully understand the steps I have outlined.
Good Luck,
Jeff