can view only be a single query.  
Author Message
exploreman





PostPosted: Wed Dec 27 03:25:01 CST 2006 Top

SQL Server Developer >> can view only be a single query.

Hi,
Right now we have some views to fetch some custom data from the combination
of columns, but the performance of the query is quite bad.

Is it possible to have the view as sql server code block, like in the stored
procedure...
these views are used at several places in the existing stored procedures...

Please suggest some good way to improve performance, or is their some tool
in SQL Server 2005, that may suggest optimization.

Regards,
sugandh

SQL Server239  
 
 
Omnibuzz





PostPosted: Wed Dec 27 03:25:01 CST 2006 Top

SQL Server Developer >> can view only be a single query. I didn't quite get what you are trying to do, but you can have a look at
inline-table valued functions (or parameterized views) in BOL.
--
-Omnibuzz

http://omnibuzz-sql.blogspot.com/


 
 
Uri





PostPosted: Wed Dec 27 04:32:06 CST 2006 Top

SQL Server Developer >> can view only be a single query. Hi

> Is it possible to have the view as sql server code block, like in the
> stored procedure...
> these views are used at several places in the existing stored
> procedures...

No it isn't. Use stored procedure





> Hi,
> Right now we have some views to fetch some custom data from the
> combination of columns, but the performance of the query is quite bad.
>
> Is it possible to have the view as sql server code block, like in the
> stored procedure...
> these views are used at several places in the existing stored
> procedures...
>
> Please suggest some good way to improve performance, or is their some tool
> in SQL Server 2005, that may suggest optimization.
>
> Regards,
> sugandh
>


 
 
Plamen





PostPosted: Wed Dec 27 09:40:41 CST 2006 Top

SQL Server Developer >> can view only be a single query. You can take a look at Common Table Expressions in SQL Server 2005. However,
since you are using your views in multiple stored procedures you will have
to define the CTEs in each stored procedure. Here are some examples:
http://www.4guysfromrolla.com/webtech/071906-1.shtml

As for performance tuning you can use the Database Engine Tuning Advisor for
tuning of indexes and the Query Execution Plan for fine tuning your code.

Regards,

Plamen Ratchev
http://www.SQLStudio.com




> Hi,
> Right now we have some views to fetch some custom data from the
> combination of columns, but the performance of the query is quite bad.
>
> Is it possible to have the view as sql server code block, like in the
> stored procedure...
> these views are used at several places in the existing stored
> procedures...
>
> Please suggest some good way to improve performance, or is their some tool
> in SQL Server 2005, that may suggest optimization.
>
> Regards,
> sugandh
>