Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL-server-2005
@CategoryID
select
(SELECT dbo.udf_GetQtyOnHand(invID)) QtyOnHand,tblInventoryMaster.*,tblUnitMaster.*,tblNonStockDetails.*
from tblNonStockDetails
left outer join tblInventoryMaster on tblNonStockDetails.nsdInventoryID=tblInventoryMaster.invID
left outer join tblUnitMaster on tblInventoryMaster.invBaseUnitID=tblUnitMaster.unID
where tblInventoryMaster.invCategoryID in (select * from tblInventoryCategory where invcatNodeID=@CategoryID 
order by ISNULL (NULLIF(invcatParentNodeID,0),invcatNodeID),invcatParentNodeID,invcatNodeID)
and tblNonStockDetails.nsdDocType='MR1'
end 
I am getting this error.
"The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified."

How to do modifications in this query. the order by condition is according to tree view.
Posted 23-Feb-13 20:18pm
Edited 23-Feb-13 22:48pm
(no name)498.6K
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Maciej Los 305
2 Richard MacCutchan 270
3 Mathew Soji 220
4 BillWoodruff 210
0 OriginalGriff 8,834
1 Sergey Alexandrovich Kryukov 7,477
2 DamithSL 5,689
3 Maciej Los 5,329
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web01 | 2.8.1411028.1 | Last Updated 24 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100