Well for starters your SQL is complete nonsense.
Start simple.
-
Use a SQL tool (like microsoft sql server management studio) and get a simple SELECT working
-
Copy there working SQL to an MSSQL node and ensure it works
-
Try building the dynamic where clause using {{{mustache}}} syntax (and read the help info and examples provided in the side bar info panel for the MSSQL-PLUS node)
Edit...
The connection is probably not setup correctly either (that's why you're getting connection errors)
Try this simple query
select getdate() as 'servertime'
that query should work on any MS SQL server without having to know what databases or tables it has. Use that as a simple test query to ensure your connection settings are correct.