KenHigg
03-14-2006, 12:53 PM
What would be a good way of explaining the diff between a view and a sp? (For a job interview question..:) )
|
View Full Version : View vs SP KenHigg 03-14-2006, 12:53 PM What would be a good way of explaining the diff between a view and a sp? (For a job interview question..:) ) Kodo 03-14-2006, 03:53 PM Views are like "virtual" tables if you will. They are good for "hiding" things from developers.. Lets say a devleoper wanted to get Personnel info for a front end display.. the DBA can refuse access to the table directly and offer a view that only shows pertinant information to the developers application, effectively hiding any personally identifying info about any ..say .. employee in the database. A developer doesn't always really need to that stuff. Think of it as a custom "VIEW" of a table. You would "view" the data in a view using SQL just like you would a table.. so: SELECT * FROM viewname WHERE condition=some_value A stored procedure is a flat out procedure that acts up on tables directly and returns data. It can incorporate business logic seperate from an application. |