If all SQL is doing is SELECT, is there an advantage to using a view vs a SPROC.
From my point of view, it’s purely organizational, but I am wondering if there is a good reason for using views when all a SPROC is doing is SELECTs and has no writes to the DB.
I’m on Sql Server 2008 but this can probably apply to other SQL server products
If all SQL is doing is SELECT, is there an advantage to using a
Share
Views are meant to abstract out the details of the underlying table and provide a window to the data, the way you want it to appear.
Stored procedures achieve a specific task and optionally take parameters that would be used during the task execution.
If you would like to run a specific task by taking arguments from the users, then you can create a stored procedure.
If you just want to expose data in a given way and leave further filtering, if required, to the users, you can create a view.