user17269960
user17269960

Reputation:

When referencing a view in a stored procedure query, does it get evaluated or act as a placeholder for the query text?

If we had a query that references SQL Server views, do the views get evaluated separately (i.e. like a sub-query) or does it just get replaced by the view's query before evaluating it as a single query?

Hoping to optimize performance!

Upvotes: 0

Views: 226

Answers (1)

David Browne - Microsoft
David Browne - Microsoft

Reputation: 89361

Just like a sub query a view is not evaluated separately. The view is combined with the referencing query and optimized as a single query.

Upvotes: 1

Related Questions