Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
johnsql
Posting Yak Master
161 Posts |
Posted - 2006-03-22 : 09:51:38
|
| Folks,I want to use a View or a Stored Procedure to get a derived table which is generated by using SELECT statement(s) along with many joins of other physical tables.What are the drawbacks of using View or Stored Procedure? I mean comparisons of their performance, occupied physical database spaces, re-compiling needs, maintenance.Thanks so much.johnsql |
|
|
timmy
Master Smack Fu Yak Hacker
1242 Posts |
Posted - 2006-03-22 : 18:05:20
|
| They're different animals. A view is basically a stored query that can be used an other views/queries/stored procs. They are nice to use because they can hide the intricacies of your db design and just present what you want to display.A stored procedure can be used to return the same data as a view, but the drawback is that you can't subsequently use its output in queries/views etc. The upside is that you can use parameters with stored procs to filter data.Suggest you do some reading up on Books Online or similar.HTH,Tim |
 |
|
|
heze
Posting Yak Master
192 Posts |
Posted - 2006-03-22 : 22:22:44
|
| Hi John,CHeck books online as timmy says, you also want to check user defined functions. Another option is to create a temporary or concrete table within a stored proc, a catch though, i believe u canot create temp tables within a sp in which case create it with dynamic sql using exec('select * into #temp from UrTbl'), then u can use this created table as any other table, it all depends what your objectoves are |
 |
|
|
|
|
|