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?...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| 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..." |
![]() |
| Thread Tools | |
| Display Modes | |
| |
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 |