DocumentServiceQueryable.AsSQL<TSource> Method (IOrderedQueryable<TSource>, String)

Creates and returns a SQL query.

Namespace:  Microsoft.Azure.Documents.Linq
Assembly:  Microsoft.Azure.Documents.Client (in Microsoft.Azure.Documents.Client.dll)


<ExtensionAttribute> _
Public Shared Function AsSQL(Of TSource) ( _
    source As IOrderedQueryable(Of TSource), _
    sqlExpression As String _
) As IQueryable(Of Object)
Dim source As IOrderedQueryable(Of TSource)
Dim sqlExpression As String 
Dim returnValue As IQueryable(Of Object)

returnValue = source.AsSQL(sqlExpression)
public static IQueryable<Object> AsSQL<TSource>(
    this IOrderedQueryable<TSource> source,
    string sqlExpression
generic<typename TSource>
static IQueryable<Object^>^ AsSQL(
    IOrderedQueryable<TSource>^ source, 
    String^ sqlExpression
static member AsSQL : 
        source:IOrderedQueryable<'TSource> * 
        sqlExpression:string -> IQueryable<Object> 
JScript does not support generic types and methods.

Type Parameters

  • TSource
    The source type.


  • sqlExpression
    Type: System.String
    The SQL query language expression.

Return Value

Type: System.Linq.IQueryable<Object>
The query result set.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IOrderedQueryable<TSource>. When you use instance method syntax to call this method, omit the first parameter. For more information, see or


Refer to the DocumentDB SQL query documentation for syntax and examples.

See Also


DocumentServiceQueryable Class

AsSQL Overload

Microsoft.Azure.Documents.Linq Namespace