This topic applies to the Power Query Formula Language (informally known as "M") which can be used with Power Query and Power BI Desktop to build queries that mashup data. See the list of function categories.

Returns a table containing SQL tables located on a SQL Server instance database.

Sql.Database(server as text, database as text, optional options as nullable record) as record  




The name of the SQL Server instance. The port may be optionally specified, separated by a colon or a comma.


The database in the SQL Server instance.

optional options

An options record to control the behavior of this function.



MaxDegreeOfParallelism as number or integer

Sets the value of the "maxdop” query clause in the generated SQL query.

CreateNavigationProperties as logical

Sets whether to generate navigation properties on the returned values. Default is true.

NavigationPropertyNameGenerator as function

Provides a function that is used for the creation of names for navigation properties.

Query as text

Provide a query text that is run on the server to return values

CommandTimeout as duration

Specifies how long the server-side query is allowed to run before it is cancelled. The default value is 10 minutes.

Sql.Database("localhost", "Northwind", [Query= select * from Customers])   

© 2015 Microsoft