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 |
|
DeepakNewton
Starting Member
39 Posts |
Posted - 2007-07-16 : 02:20:22
|
| I have a view where in i need to sort by lastname , could any plz go thru below statement and let me know this Statement the optimized one because i used TOP 100 Percent i do no whether it will cause performance in the view, since i cant directly access Table. only to sort by lastname i used TOP 100 percent Create view vwEmp ASSELECT TOP 100 Percent EmpAccNo, FirstName, LastName, DeptNo FROM tblZAEmployee EM INNER JOIN tblZADepartment DPON DP.deptNo=EM.deptnoORDER BY LastName ASCThanks Deepak |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-16 : 04:45:23
|
| Why dont you create a view without Order by and use order by when selecting data from it?MadhivananFailing to plan is Planning to fail |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2007-07-16 : 20:49:59
|
| ORDER BY in a view is meaningless. You have to do it on the select. This is especially true ifa) You join to the viewb) You move up to SQL Server 2005 where this side effect has been optimised out. |
 |
|
|
|
|
|