I started to learn functions and stored procedures in Microsoft SQL Server and noticed that everything that they do also can be done with a queries. I'm sure, they exist for a reason, so I'd like to ask:
- What can be done using functions / procedures that's impossible to do with a query?
- In which cases one should use procedures/functions and not queries?