Test-SqlScript

Determines whether a SQL script is valid.

Syntax

Test-SqlScript [-InputScript] <String> [[-QuotedIdentifierOff]] [[-SqlVersion] <SqlVersion>] [<CommonParameters>]

Detailed Description

The Test-SqlScript cmdlet determines whether all elements of a SQL script are valid. It returns "true" ($true) if all elements are valid and "false" ($false) if any are invalid. Validation errors are returned to stderr.

Related Commands

* Out-SqlScript

Parameters

Name Description Required? Pipeline Input Default Value
InputScript  Specifies a SQL script to be tested.  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 

Input Type

String

Return Values

Boolean

Examples

EXAMPLE 1

Test-SqlScript "Select * from authors"
Determines whether the SQL script is valid