The following script will feed ConvertTo-Html
with $null
value.
Invoke-SqlCmd -ServerInstance xxxx "select top 0 1 A -- returns no row" |
ConvertTo-Html -Fragment
It will generate the following html code. Is there a simple way (without introducing variable and if statement) to not generate the empty <table>
but a text message if the input is null?
<table>
</table>
Or is there a way to let Invoke-SqlCmd
return a string if empty?