I have the following powershell command which displays the number of rows in a sql table. This works but it also includes the header:
Invoke-Sqlcmd -ServerInstance "01-SQL1\INSTANCE22" -Database master -Query "select Count(*) from dbo.mytable"
The Output I get is:
Column1
-------
2450 <= This line is actually displayed under Column1 on a separate line. I just couldn't get it to display properly here.
The only output I need is to show me the row count if it's greater than X number of rows, otherwise print "Less than 5000 rows found." How do I do this?