Between code (C#, Java) and database (SQL) where should we sort or filter?
In code it means having a single stored procedure to retrieve all data from the database and then filter my data (in the business or data layer).
In database it means having a stored procedure. In this case the code (data layer) send my filter settings to stored procedure that takes care to return a lightened data.
What is better and in what circumstances?