Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# SQL VisualStudio2010
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 at 8-Mar-13 7:52am
   
You can order by in string column...
Davidduraisamy at 8-Mar-13 7:54am
   
can u provide sample example
ryanb31 at 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
0 OriginalGriff 304
1 Maciej Los 285
2 Sergey Alexandrovich Kryukov 255
3 Shweta N Mishra 216
4 PIEBALDconsult 174
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 8 Mar 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