IT Community - Software Programming, Web Development and Technical Support

How to rearrange the columns of the table without lose of data?

This is a discussion on How to rearrange the columns of the table without lose of data? within the ASP and ASP.NET Programming forums, part of the Web Development category; How to rearrange the columns of the table without lose of data?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > ASP and ASP.NET Programming

Register FAQ Members List Calendar Mark Forums Read
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 07-18-2007, 12:18 AM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default How to rearrange the columns of the table without lose of data?

How to rearrange the columns of the table without lose of data?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-21-2008, 09:13 PM
gp_logesh gp_logesh is offline
D-Web Trainee
 
Join Date: May 2007
Posts: 29
gp_logesh is on a distinguished road
Cool Re: How to rearrange the columns of the table without lose of data?

hi...

If you need to rearrange the columns of the table and without lose of data
you can do one thing

first you have to create one temp table with the same columns with your own order of columns. Then select the original table values and insert in to the new table and his corresponding order. Then finally drop the temp table....

CREATE TABLE temp(ENO INT, ENAME VARCHAR(20), JOB VARCHAR(20), SAL INT, ROLE_NO INT)
INSERT INTO temp (ENO,ENAME,JOB,SAL,ROLE_NO) SELECT ENO,ENAME,JOB,ROLE_NO ,SAL FROM EMP

DROP TABLE EMP

SELECT * INTO EMP FROM temp

SELECT * FROM EMP


Then finally you get the table with rearranged columns....
SELECT ENO,ENAME,JOB,ROLE_NO ,SAL FROM EMP

select * from temp



Enjoy....
__________________
"GP_Logesh..."
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/asp-asp-net-programming/2065-how-rearrange-columns-table-without-lose-data.html
Posted By For Type Date
Digg / Programming / Upcoming This thread Refback 07-20-2007 05:21 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create index for all columns in a view? oxygen Database Support 1 02-07-2008 01:53 AM
Count the columns alone having data in a record set $enthil Database Support 4 12-04-2007 03:25 AM
What is the difference between DELETE TABLE and TRUNCATE TABLE commands in SQL Server oxygen Database Support 6 11-23-2007 06:17 AM
What is the difference between global and action sheets within the data table in QTP? sundarraja Testing Tools 1 08-13-2007 11:50 PM
How to copy data from one data table to another datable kingmaker C# Programming 1 07-24-2007 12:05 AM


All times are GMT -7. The time now is 10:08 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0