Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-11-27 : 08:58:15
|
| Brian OConnell writes "Is it possible to change the order of fields. i.e. if your table is created as follows:-create table Names(name varchar(20),id int)where rather foolishly the id has been placed second is it possible to change the order so that id is first.P.S. being Irish my name is of the O'somebody variety which isn't accepted. Simple enough error to correct - replace(name, "'", "''")." |
|
|
JustinBigelow
SQL Gigolo
1157 Posts |
Posted - 2001-11-27 : 09:13:04
|
| The order of the columns isn't going to affect your application in any way, it's really just aesthetic. When you do your select statement instead of select * ... use select id, name .... If you really want to change the order you'll have to drop the name column and re-add it, it should go to the bottom of the list.Justin |
 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2001-11-28 : 15:11:39
|
| To preserve your data, and/or to re-order multiple columns, create another table to hold your data, and use Insert...SELECT to move the data in there. If you create the other table in the proper column order, then you just have to drop the original table and rename the second one. Of course, doing this will mess with any indexes and foreign keys, so you'll need to account for dropping/recreating them as well.-------------------It's a SQL thing... |
 |
|
|
|
|
|