Saturday, February 25, 2012

Reorder the table definition of a SQL 2005 table

Hi,

Is it possible to reorder the table definition in a SQL 2005 table?

Example : i want to put to table definition in alphabetical order.

Thanks in advance

I dont understand. do you mean re-ordering of columns in the table?

|||

When i look at my table, i see that the columns are in this order :

CatId
SubCatId
ImageId
PhoneNumber
Adress
Fax
Cell

But if i want to have this order (alphabetical order) :

Adress
CatId
Cell
Fax
ImageId
PhoneNumber
SubCatId

How can i do that?

|||

The order of columns in a table does not matter. So does order of rows in a table.

You can always write your SELECT statement to return the rows in the column order you want.

SELECT Adress, CatId, Cell, Fax, ImageId, PhoneNumber, SubCatId

FROM YoutYable


|||

Ok but if i want to arrange the order of columns when i open the table with SQL Server Management Studio to see them in alphabetical order...

Can i do that?

|||

The bigger question is why? It is just a GUI thing.

|||

I know that!

It's just that i like my things to be ordered ;-)

So?

|||

Right click on the table --> Design view, you can drag the columns up or down.

|||

Ok Thanks!

No comments:

Post a Comment