Out-SqlScript

Sends out to the host as a SQL script.

Syntax

Out-SqlScript [-InputScript] <String> [[-QuotedIdentifierOff]] [[-SqlVersion] <SqlVersion>] [[-AlignClauseBodies]] [[-AlignColumnDefinitionFields]] [[-AlignSetClauseItem]] [[-AsKeywordOnOwnLine]] [[-IncludeSemicolons]] [[-IndentationSize] <Int32>] [[-IndentSetClause]] [[-IndentViewBody]] [[-KeywordCasing] <KeywordCasing>] [[-MultilineInsertSourcesList]] [[-MultilineInsertTargetsList]] [[-MultilineSelectElementsList]] [[-MultilineSetClauseItems]] [[-MultilineViewColumnsList]] [[-MultilineWherePredicatesList]] [[-NewLineBeforeCloseParenthesisInMultilineList]] [[-NewLineBeforeFromClause]] [[-NewLineBeforeGroupByClause]] [[-NewLineBeforeHavingClause]] [[-NewLineBeforeJoinClause]] [[-NewLineBeforeOpenParenthesisInMultilineList]] [[-NewLineBeforeOrderByClause]] [[-NewLineBeforeOutputClause]] [[-NewLineBeforeWhereClause]] [<CommonParameters>]

Detailed Description

The Out-SqlScript cmdlet determines whether all elements of a SQL script are valid and returns formatted SQL script (pretty print) if all elements are valid. Validation errors are returned to stderr. You can use the various parametres to control the formatting of the script.

Related Commands

* Test-SqlScript

Parameters

Name Description Required? Pipeline Input Default Value
InputScript  Specifies a SQL script to be sent to host.  true  true (ByValue)   
QuotedIdentifierOff  Specifies whether quoted identifier handling is off.  false  false  false 
SqlVersion  Specifies the Sql version. Valid values are Sql80, Sql90 and Sql100.  false  false  Sql100 
AlignClauseBodies  Specifies whether to align clause bodies.  false  false   
AlignColumnDefinitionFields  Specifies whether to align column definition fields.  false  false   
AlignSetClauseItem  Specifies whether to align set clause items.  false  false   
AsKeywordOnOwnLine  Specifies whether to put AS keyword on own line.  false  false   
IncludeSemicolons  Specifies whether to include semicolons.  false  false   
IndentationSize  Specifies indentation size.  false  false 
IndentSetClause  Specifies whether to indent set clause.  false  false   
IndentViewBody  Specifies indent view body.  false  false   
KeywordCasing  Specifies keyword casing option. Valid values are Lowercase, Uppercase or PascalCase  false  false  Uppercase 
MultilineInsertSourcesList  Specifies whether multiline insert sources list.  false  false   
MultilineInsertTargetsList  Specifies whether multiline insert targets list.  false  false   
MultilineSelectElementsList  Specifies whether multiline select elements list.  false  false   
MultilineSetClauseItems  Specifies whether multiline set clause items.  false  false   
MultilineViewColumnsList  Specifies whether multiline view columns list.  false  false   
MultilineWherePredicatesList  Specifies whether multiline where predicates list.  false  false   
NewLineBeforeCloseParenthesisInMultilineList  Specifies new line before close parenthesis multiline list.  false  false   
NewLineBeforeFromClause  Specifies new line before from clause.  false  false   
NewLineBeforeGroupByClause  Specifies new line before group by clause.  false  false   
NewLineBeforeHavingClause  Specifies new line before having by clause.  false  false   
NewLineBeforeJoinClause  Specifies new line before join clause.  false  false   
NewLineBeforeOpenParenthesisInMultilineList  Specifies new line before open parenthesis in multiline list  false  false   
NewLineBeforeOrderByClause  Specifies new line before order by clause.  false  false   
NewLineBeforeOutputClause  Specifies new line before output clause.  false  false   
NewLineBeforeWhereClause  Specifies new line before where clause.  false  false   

Input Type

String

Return Values

String

Examples

EXAMPLE 1

Out-SqlScript "Select * from authors"
Outputs the SQL script with default options SELECT * FROM authors;