Below is code snippet from Powershell
$query = "select MAX(convert(varchar(10),server_time,102))from status_history where status not like ('ERROR FETCHING%')"
$servers = Invoke-Sqlcmd2 -query $query -ServerInstance "100.81.60.2" -Database "temp" -Username "temp" -password "temp"
I need to check in Powershell if the sql query contained in $query
returns NULL
.
I tried using
if($servers.Column1 -eq NULL)
but it doesnt seem to work.