OleDb.Query

OleDb.Query is a Power Query M function that runs a specified query using an OLE DB connection string. The function returns the query result with control over options like connection and command timeouts.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

OleDb.Query(
   connectionString as any,
   query as text,
   optional options as nullable record,
) as table

Description

Returns the result of running query with the connection string connectionString using OLE DB. connectionString can be text or a record of property value pairs. Property values can either be text or number. An optional record parameter, options, may be provided to specify additional properties. The record can contain the following fields:

  • ConnectionTimeout : A duration that controls how long to wait before abandoning an attempt to make a connection to the server. The default value is driver-dependent.
  • CommandTimeout : A duration that controls how long the server-side query is allowed to run before it is canceled. The default value is ten minutes.
  • SqlCompatibleWindowsAuth : A logical (true/false) that determines whether to produce SQL Server-compatible connection string options for Windows authentication. The default value is true.

Other functions related to OleDb.Query are:

BI Gorilla Blog

Last update: August 17, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/oledb-query
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.