Natural language queries for SQL Server.
Connect Microsoft SQL Server to InsightLab and let your team ask about invoices, customers and regions in plain language. Results come back as tables or charts, under the workspace roles and row- and column-level rules your admins configure.
Finance questions, written as T-SQL.
SQL Server speaks T-SQL, which differs from other dialects in small but constant ways. These three questions about invoicing show the kind of query each one becomes.
Illustrative examples. The SQL below was written by hand against a sample schema (Sales.Invoices and Sales.Customers) to show the SQL Server dialect. It is not output captured from InsightLab, and your own tables and columns will differ.
“Who are our top 10 customers by invoiced amount in the last 90 days?”
T-SQL limits rows with TOP where other dialects use LIMIT, and DATEADD moves a date by a number of days. Tables are addressed as schema.table, here Sales.Invoices.
Illustrative SQL Server SQL on a sample schema SELECT TOP (10) c.CustomerName, SUM(i.TotalAmount) AS InvoicedAmount FROM Sales.Invoices AS i JOIN Sales.Customers AS c ON c.CustomerID = i.CustomerID WHERE i.InvoiceDate >= DATEADD(DAY, -90, CAST(GETDATE() AS date)) GROUP BY c.CustomerName ORDER BY InvoicedAmount DESC;“How much did we invoice each month over the last 12 months?”
DATETRUNC rounds a date down to the first of its month. It was added in SQL Server 2022. On earlier versions the same grouping is commonly written with DATEFROMPARTS(YEAR(d), MONTH(d), 1).
Illustrative SQL Server SQL on a sample schema SELECT DATETRUNC(month, InvoiceDate) AS InvoiceMonth, SUM(TotalAmount) AS InvoicedAmount FROM Sales.Invoices WHERE InvoiceDate >= DATEADD(month, -11, DATETRUNC(month, GETDATE())) GROUP BY DATETRUNC(month, InvoiceDate) ORDER BY InvoiceMonth;“Which regions have invoices more than 30 days overdue, and how much is outstanding?”
An unpaid invoice is one with no PaidDate, so the filter is IS NULL. The 30-day cut-off is DATEADD again, this time compared with the due date.
Illustrative SQL Server SQL on a sample schema SELECT c.Region, COUNT(*) AS OverdueInvoices, SUM(i.TotalAmount) AS OverdueAmount FROM Sales.Invoices AS i JOIN Sales.Customers AS c ON c.CustomerID = i.CustomerID WHERE i.PaidDate IS NULL AND i.DueDate < DATEADD(DAY, -30, CAST(GETDATE() AS date)) GROUP BY c.Region ORDER BY OverdueAmount DESC;
What’s distinctive about asking questions of SQL Server.
SQL Server is the database many companies run because their other software depends on it. Accounting packages, ERP systems and in-house line-of-business applications commonly keep their data there, which makes it a frequent home for invoices, stock and customer records.
That has two consequences. The data is often sensitive, so who can see which rows and columns matters as much as getting an answer. And the schema usually belongs to an application, with table and column names that mean little to the people asking. InsightLab covers the first with workspace roles and row- and column-level rules for database queries, and the second with business definitions and reviewed question-and-SQL examples.
SQL Server groups tables into schemas such as dbo or Sales inside each database. InsightLab connections can be scoped to specific databases and schemas where supported.
Decide who sees which rows and columns.
Opening a finance database to plain-language questions only works if access stays under control.
Row-level query rules
Limit which records a database query can return, based on the access rules your admins configure.
Column-level query rules
Restrict access to sensitive fields on the database tables you configure.
Administrative audit logs
Review recorded activity in the admin console, and filter entries by user, activity or time period.
Questions about InsightLab and SQL Server.
Can InsightLab query Microsoft SQL Server without anyone writing T-SQL?
Yes. Ask a business question in plain language and InsightLab builds the database query for you, then returns the result as a table or chart.
Can we hide cost or salary columns from some users?
Admins can configure column-level rules that restrict access to sensitive fields on configured database tables, and row-level rules that limit which records a query can return.
Is there a record of activity we can review?
Yes. Recorded activity can be reviewed in the admin console and filtered by user, activity or time period.
Can people ask SQL Server questions from our intranet?
The InsightLab assistant can be added to an internal portal or web application, so teams can ask questions where they already work.
See it answer your team’s questions.
Tell us what your team wants to answer and which sources you use. We’ll walk through the product with you.
