Click here to Skip to main content
12,065,888 members (39,145 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# SQL VS2010
Hi Coders, Im working on an enterprise application project, and need to order the ITEM_NAME by DAMAGE_REF_NO . im basically selecting and returning data from two views and want to bind them to an Infragistics Ultraweb Grid, please how do I Order by for the select @item, heres my whole stored Procedure:




create PROCEDURE [dbo].fetchDamageAssessmentForVoucherPrinting
   (
   @SUBSCRIBER_ID varchar(20),
   @DAMAGE_REF_NO  varchar(20)
   )
 
    AS
           declare @ITEM varchar(max)
           set @ITEM = ''
 
           SELECT @ITEM = ((SELECT   ',' + ITEM_NAME  FROM DAMAGE_DETAILS_VW   FOR XML PATH('') )  )
 

 
    SELECT * , @ITEM AS DESCRIPTION FROM  DAMAGE_ASSESSMENT_VW2 WHERE DAMAGE_REF_NO = @DAMAGE_REF_NO AND  SUBSCRIBER_ID = @SUBSCRIBER_ID
 

       RETURN
Posted 8-Mar-13 2:50am
Comments
Davidduraisamy 8-Mar-13 7:52am
   
You can order by in string column...
Davidduraisamy 8-Mar-13 7:54am
   
can u provide sample example
ryanb31 8-Mar-13 8:10am
   
I'm confused. You can't order by a column? How come? What did I miss?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

You can use
SELECT * FROM yourtablename ORDER BY columname [ASC, DESC]
.

Hope it helped you out so far.


cheers,
Marco Bertschi
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web04 | 2.8.160207.1 | Last Updated 8 Mar 2013
Copyright © CodeProject, 1999-2016
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