Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
If there is a view with a single SELECT query and SP with the same SELECT query to display a record on ASP web page which would be used and why- what is the effect on performance?

What I have tried:

......................................................
...........
Posted

They are indeed different and serve different purpose. Views are nothing but SQL usually represent One complex presentation scenario like search screens, reports, exports, etc.

However stored procedures are like binaries that may execute complex business use cases. Like complex reversal scenarios, ETL process, Data Archiving and many more.

There is another view to this subject which is providing post production support. In support model we need to provide fixes in minimum timeframe. Stored procedures and views both are handy as they do not get directly coupled with the business layer. You can independently alter stored procedure and provide the fix directly to production without breaking any layers and does not require full application smoke testing.

In your case using stored procedure is like killing a bug with a Tank. Try making things simple, the way they are.
 
Share this answer
 
View represents a virtual table in Database. You can implement join multiple tables in a view to get result.

A stored procedure is database which executes bunch of SQL statements like updating and inserting data, or returning single/multiple values or data sets.

In which scenario View/SP need to use:

View: If you want to fetch records from table(s) without any dynamic filter then use View.
For instance, to fetch top 10 records from table based on transaction - here we do not need any parameter

SP:
1. If you want to declare local variable and want to implement custom then use SP
2. If you want to implement transcation then use SP
3. You can execute other SP or function inside SP

Go through below link: sql - Is there any performance difference between view and stored procedures - Stack Overflow[^]

Choose as per your need and requirement.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900