Share via


TSqlObject.TryGetAst(TSqlScript) Method

Definition

Attempts to generate an AST for the object. AST generation is only supported for top-level objects, with certain objects such as the DatabaseOptions and inline constraints not supporting AST generation even though they are top level types.

The generated AST is a newly generated object that defines the information about this TSqlObject and any objects that would be scripted together with it. For example a Table would also script out the Columns and inline constraint definitions of a Table. This method can be used to copy object information from one model to another, or to script out information about objects in the model.

public bool TryGetAst (out Microsoft.SqlServer.TransactSql.ScriptDom.TSqlScript objectAst);
member this.TryGetAst : TSqlScript -> bool
Public Function TryGetAst (ByRef objectAst As TSqlScript) As Boolean

Parameters

objectAst
TSqlScript

Returns the generated AST if the call succeeded.

Returns

True if AST generated. Otherwise false.

Remarks

The Ast will not have information about the original source position, such as the original source name and original position in an input script.

Applies to