January 27, 2006 at 3:00 am
Hi,
I am using the tool SQL Manager 2005 Lite for reordering columns in my tables.
What this tool does is drop the table and rebuild it again with the new column order.
But there are foreign keys defined so I can not just drop the table without dropping the foreign keys..
How can this be done without dropping the table..?
Cheers,
Jan
January 27, 2006 at 3:15 am
How can this be done without dropping the table..?
You cannot. And like I said in a similar thread the other day, you should not care about the order of columns in a table. The fact that SQL (the standard) and it's implementations (such as SQL Server) has an ordering of attributes in a relation (i.e. columns in a table) is a flaw that you should not reinforce by actually depending on it.
January 27, 2006 at 4:09 am
Chris,
Thanks for your quick reply!
I will explain our situation:
For each record in each table we track who and when a record is stored/modified in columns of that specific table. Normally these columns are at the end of each tables. But because we added columns to our tables the are not at the end.
For our own convenience we want these columns on the end of the tables.
Can't this be done using the syscolumns tables...??
Jan
January 27, 2006 at 8:09 am
Since the data is stored on disk SQL Server needs to know which column is where. If you change in syscolumns it will get completely screwed up.
Can you not live with seeing the columns in a particular order in EM? Queries should not use SELECT * but instead name the columns, so it should not be a problem there.
January 27, 2006 at 8:10 am
And if you really need to see the columns in a specific order, why not create a view that 'changes' the order? Then use that to look at the data.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply