I created systems where all SQL is stored in procedures and the names of stored procedures are not stored in the program themselves, but in app.config.
This means that not only stored procedures can be fixed, but different clients can use different procedures.
The database services interface provided to the application (s) is thus part of the system design.
The disadvantage of having any SQL in the client application in general (and this includes ORM and LINQ) is table-based, because you have very little explicit security interface. With stored procedures, there is one GRANT - EXEC. With tables or even ORM views, you need SELECT, UPDATE, INSERT, DELETE for any SQL generated by the tool or stored in the application. Carrying out an inventory of the rights necessary for the proper operation of the system and the possibility of auditing is much more complicated than having a good solid level of stored procedures (and, to some extent, read-only) that everything goes through.
Therefore, I would say that โSELECT value1, value2 FROM TABLEโ is unacceptable for client code, because every user who would potentially execute this statement must have SELECT in these two columns from the base table, and this is difficult to manage, even with roles .
source share