.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

Order By in Sql [its an Urgent]

Posted By: Sunil     Posted Date: December 04, 2008    Points:2   Category :Sql Server

i want to sort some column in table!

How i am doing:-

Select * from tablename Order By columnName

This gives me right data
But Problem is Here?????

It not change in actual table data, that query only shows temporary view..?

So can any one please help me How this query change my actual table column field as showing in temporary view.

Author: Amit Mehra             
Posted Date: December 04, 2008     Points: 5   

I dont know why you need this when you can sort into client side or using order by clause. but try like this

1) Insert all the data into temp table
2) delete the existing data
3) insert again the the data stored in temp table into the original Table using order by command in temp table.

Hope this helps

Please "Mark As Answer " if this post help you.
Author: Shashi Ray             
Posted Date: December 07, 2008     Points: 5   

Hello sir, Please try with code,

First Run this Query,
1. Select * into tablenameNew from tablename where 1>2;
This query is created new table, where tablenameNew=NewTableName ane tablename=OldTableName.


2. insert into tablenameNew select distinct * from tablename order by ColumnName;
This Query is Copy the Data from tablename and Paste in tablenameNew.

Shashi Ray

Shashi Kant Ray

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend