Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Efficient use of views

Status
Not open for further replies.

RRinTetons

IS-IT--Management
Joined
Jul 4, 2001
Messages
333
Location
US
I'm working on some reporting from our financial accounting system. I need data for a specific range of accounts for last year and the current one. I'll use various date ranges out of those views for the reports I'm doing.

Is it more efficient to declare the views with the overall date ranges as part of the view definition and then query that view for the specific dates or smaller ranges I need, or, should I just declare the view for the entire table without reference to the date range and do the same query for the report? Or, is there really no difference at all as the db engine has to do the same work no matter which way I phrase it?

-
Richard Ray
Jackson Hole Mountain Resort
 
There wouldn't be any different unless you were to index the view.

Denny
MVP
MCSA (2003) / MCDBA (SQL 2000)
MCTS (SQL 2005 / SQL 2005 BI / SQL 2008 DBA / SQL 2008 DBD / SQL 2008 BI / MWSS 3.0: Configuration / MOSS 2007: Configuration)
MCITP (SQL 2005 DBA / SQL 2008 DBA / SQL 2005 DBD / SQL 2008 DBD / SQL 2005 BI / SQL 2008 BI)

My Blog
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top