TutorialsAISQLnatural language

Query SQL Server in Plain English: Natural Language for Microsoft SQL

Microsoft SQL Server runs the backend for millions of businesses — ERP systems, CRMs, financial applications, and internal tools. The data is all there. But ...

Marcus Chen· Solutions EngineerMarch 23, 20268 min read

Microsoft SQL Server runs the backend for millions of businesses — ERP systems, CRMs, financial applications, and internal tools. The data is all there. But the moment someone outside the engineering team needs a custom report, the bottleneck is the same: someone has to write T-SQL.

T-SQL is not the most forgiving dialect. Even experienced SQL developers occasionally trip over its quirks. For a product manager who just wants to know "how many enterprise customers renewed last month," the prospect of writing a JOIN across three tables and filtering on a date range is not realistic.

This article covers how natural language querying works with Microsoft SQL Server, what kinds of questions you can ask in plain English, and where the approach genuinely helps versus where you still need a human with T-SQL knowledge.

Why SQL Server Users Hit the Same Bottleneck

SQL Server is almost always managed by someone — a DBA, a data engineer, or a developer wearing multiple hats. Business users submit requests. The technical person translates them into queries. Results come back hours or days later.

The problem isn't SQL Server itself. It's the round-trip. Every time an analyst wants a new metric, they open a ticket. Every ticket takes time. By the time the data comes back, the business context has shifted.

This pattern is especially common in companies using SQL Server as the backend for a product like Dynamics 365, custom-built reporting systems, or legacy financial applications. The data model is complex, table names aren't always intuitive, and writing even a moderate query requires knowing the schema cold.

What business teams actually want is the ability to ask a question and get an answer — without understanding the difference between NOLOCK hints and proper isolation levels.

How Natural Language Querying Works with SQL Server

When you connect a natural language tool to SQL Server, the flow looks like this:

  • You type a question in plain English: "Show me total revenue by product category for Q1 2026"
  • The AI reads your database schema — table names, column names, relationships, data types
  • It generates a T-SQL query based on your question
  • The query runs against your SQL Server instance
  • Results come back as a table or chart
  • The AI doesn't have magical insight into your data. It reasons from your schema, column names, and any sample data or context you provide. That's why having descriptive column names (order_date rather than dt1) produces better results — but the AI can often infer meaning even from cryptic schemas.

    Here's an example of what that generated T-SQL might look like for the revenue question above:

    SELECT
        p.category_name,
        SUM(oi.quantity * oi.unit_price) AS total_revenue
    FROM orders o
    INNER JOIN order_items oi ON o.order_id = oi.order_id
    INNER JOIN products p ON oi.product_id = p.product_id
    WHERE o.order_date >= '2026-01-01'
      AND o.order_date < '2026-04-01'
    GROUP BY p.category_name
    ORDER BY total_revenue DESC;

    A non-technical user never sees this query. They see the result table. But you can always inspect the generated SQL — and you should, especially when building dashboards or scheduled reports where accuracy matters.

    Common T-SQL Tasks You Can Replace with Plain English

    Here are the types of questions business users regularly need answered, and what the underlying T-SQL would look like:

    "Which customers haven't placed an order in the last 90 days?"

    SELECT c.customer_id, c.company_name, MAX(o.order_date) AS last_order_date
    FROM customers c
    LEFT JOIN orders o ON c.customer_id = o.customer_id
    GROUP BY c.customer_id, c.company_name
    HAVING MAX(o.order_date) < DATEADD(DAY, -90, GETDATE())
       OR MAX(o.order_date) IS NULL
    ORDER BY last_order_date ASC;

    "What's our average deal size by sales rep this quarter?"

    SELECT
        e.first_name + ' ' + e.last_name AS sales_rep,
        COUNT(o.order_id) AS deals_closed,
        AVG(o.total_amount) AS avg_deal_size
    FROM orders o
    INNER JOIN employees e ON o.employee_id = e.employee_id
    WHERE o.order_date >= DATEADD(QUARTER, DATEDIFF(QUARTER, 0, GETDATE()), 0)
    GROUP BY e.employee_id, e.first_name, e.last_name
    ORDER BY avg_deal_size DESC;

    "How many support tickets were opened vs resolved each week this month?"

    SELECT
        DATEPART(WEEK, created_at) AS week_number,
        SUM(CASE WHEN status = 'open' THEN 1 ELSE 0 END) AS opened,
        SUM(CASE WHEN status = 'resolved' THEN 1 ELSE 0 END) AS resolved
    FROM support_tickets
    WHERE created_at >= DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE()), 0)
    GROUP BY DATEPART(WEEK, created_at)
    ORDER BY week_number;

    None of these queries are impossible for a developer to write. But they take time, and business users shouldn't have to wait for every ad-hoc question like these.

    Connecting SQL Server to AI for Database

    With AI for Database, connecting to SQL Server takes about two minutes:

  • Go to Connections and select Microsoft SQL Server
  • Enter your server address, port (default 1433), database name, username, and password
  • Choose whether to allow read-only or read-write access (read-only is recommended for business users)
  • The tool runs a schema scan — it indexes your tables, columns, and relationships
  • Once connected, you can start asking questions immediately. The schema scan means the AI understands your data model without you having to explain it each time.

    For SQL Server instances behind a firewall or running on-premises, you'll typically need to either whitelist the AI for Database IP ranges or use a connection tunnel. Both approaches are supported.

    One important note: AI for Database runs queries against your SQL Server with the permissions of the credentials you provide. If you create a read-only SQL Server login for the connection, users can't accidentally modify data — which is what you want for reporting use cases.

    Real Examples: Questions You Can Ask Your SQL Server

    Here's a sense of what real queries look like in practice, organized by team:

    Sales teams:

  • "Show me all deals closed this month that are above $50k"
  • "Which accounts have had zero activity in the past 60 days?"
  • "Compare monthly new customer count for this year vs last year"
  • Operations:

  • "What's the average order fulfillment time by warehouse this quarter?"
  • "Which suppliers have the most late deliveries in the last 6 months?"
  • "Show me inventory levels for any SKU below the reorder threshold"
  • Finance:

  • "Total revenue by region for the last 3 quarters"
  • "Which invoices are more than 30 days overdue?"
  • "Break down operating expenses by department for the current fiscal year"
  • Product/Engineering:

  • "How many users hit an error in the checkout flow this week?"
  • "What's the daily active user count for the last 30 days?"
  • "Which feature flags are enabled for more than 50% of users?"
  • Most of these translate cleanly to T-SQL because they're asking about aggregates, filters, and time ranges — exactly the kind of question SQL is built for.

    What to Watch Out For

    Natural language querying isn't perfect. A few things to keep in mind:

    Ambiguous column names cause errors. If your schema has columns named status in four different tables and you ask about "active users," the AI has to guess which table and which status value you mean. Being specific in your question ("active users in the accounts table") helps.

    Complex business logic may need human review. If your revenue calculation involves custom discounting rules, multi-currency conversions, or complex join logic that isn't reflected in the schema, the AI may generate a technically valid query that answers a slightly different question. Always spot-check results for metrics you're putting in front of leadership.

    Stored procedures and views aren't automatically surfaced. If your team has pre-built stored procedures or views that encapsulate business logic, the AI won't use them unless you explicitly point it at them or they're indexed in the schema scan.

    Write access needs careful management. Most natural language query use cases are read-only. If you're using AI for Database for reporting, give the connection read-only SQL Server credentials. This eliminates a whole category of accidental data modification risks.

    The Bottom Line

    Microsoft SQL Server is a solid database. The data quality is usually good, the infrastructure is well-understood, and the schemas tend to be mature. The gap isn't the database — it's the access layer between the data and the people who need it.

    Natural language querying closes that gap for the majority of day-to-day questions business teams have. It doesn't replace T-SQL expertise for complex analytical work, but it handles the 80% of requests that follow predictable patterns well enough that you can stop treating every data question as a development ticket.

    If your team is running SQL Server and spending engineering time on recurring report requests, try AI for Database free at aifordatabase.com — it takes about two minutes to connect and a few seconds to answer your first question.

    Ready to try AI for Database?

    Query your database in plain English. No SQL required. Start free today.