I\'m trying to select a column from a single table (no joins) and I need the count of the number of rows, ideally before I begin retrieving the rows. I have come to two app
IF (@@ROWCOUNT > 0) BEGIN SELECT my_table.my_col FROM my_table WHERE my_table.foo = 'bar' END