I have a PowerShell script that is reading some data from a SQL Server using the standard SqlConnection, SqlCommand approach.
When I execute the following SELECT Bob, fred FROM x I get a list of values.
However, if I try and add a filter SELECT Bob, fred FROM x WHERE fred = 'abc' I get nothing - it doesn't matter what the filter is, it always returns an empty dataset - pasting the query into SQL Server returns rows.
I am using SqlDataAdapter.Fill to return a DataSet. Have tried using a DataTable and a Reader (executeReader) but the same result.
I can't select the entire table as there are too many rows.
Does anyone know how to filter rows in a query without having to return the entire table?