Welcome to the Alteryx Knowledge Base

SQL Server - SQL Editor Test Query Failed With "Error opening <query>: No Columns Returned."
user

Created/Edited - 4/19/2026 by Jon Lin | Alteryx

Summary
For a SQL Server connection, the Test Query in the SQL Editor is returning with message "Error opening <query>: No Columns Returned."
Description
Troubleshooting the error:
Error opening <query> : No Columns Returned
image.png
 
Issue
For a SQL Server connection, the Test Query in the SQL Editor is returning with message "Error opening : No Columns Returned.
Environment
Alteryx Designer
  • Input Tool | SQL Editor | Test Query
  • SQL Server DSN-Less or DSN
Cause

If the SQL Server DSN-Less connection string or DSN does not include a default database, the SQL Editor does not know which database to validate the query against.

Resolution

If you do not wish to include a default database in either the DSN-less connection string or the DSN, go to Solution A. If you want to set a default database, go to Solution B.
 

Solution A - Qualify the Table Call in the SQL With the Database Name and Schema That the Table Belongs Too

 

  1. Paste your query into the SQL Editor
  2. For all tables referenced in the query, qualify them with the database name and the schema to which the tables belong.
    • For example, if you have "SELECT * FROM Department," you will change it to "SELECT AdventureWorks2017.HumanResources.Department.* FROM AdventureWorks2017.HumanResources.Department."

 

Solution B - Specify a Default Database in the DSN-Less Connection String or DSN

 

  1. If you are using a DSN-less connection string, make sure to include the DATABASE= parameter.
  2. For example,  odbc:Driver={SQL Server Native Client 11.0};Server=ayx.extendthereach.com\sql;Database=AdventureWorks2017;Uid=testdummy;Pwd=__EncPwd1__;Trusted_Connection=yes
  3. If creating a DSN, check the box "Change the default database to" and enter the database name

 

image.png
 
Additional Information

Note: The “No Columns Returned” error is most commonly caused by a missing database context in the SQL connection. Defining a default database or fully qualifying table references will resolve the issue in most cases. 

 

Was this article helpful?