Operators

A task commonly performed both from the console and also in scripts is to compare two strings against each other. The most common operators are as follows:

Image Arithmetic—When comparing numbers or integers, for example:

5 -gt 4

Image Comparison—When comparing strings, for example:

"user" -eq "user"

In both of these cases, a Boolean value is returned (True or False).

Note

Execute the Get-Help about_operator command for more information and examples.

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.