Right off the bat, I'm not interested in anyone giving me grief regarding
this issue. I have (IMHO) valid reasons for this. And I also will refer you
to Erland Sommarskog's response to a similar post a couple years ago:
http://groups.google.com/group/comp.databases.ms-sqlserver/browse_thre...thread/
Having got that out of the way, here's my question. I know that the column
order is stored in syscolumns.colorder. Does anyone know of any problems
that can occur by changing that value after adding a new column to a table?
For example, I have the following table:
Customers:
CustID
CustName
CustPhone
I added a new column as follows:
ALTER TABLE Customer ADD CustSex so that I end up with this as viewed from
EM:
Customers:
CustID
CustName
CustPhone
CustSex
However I want this:
Customers:
CustID
CustSex
CustName
CustPhone
It seems that I could simply run the following:
UPDATE tcols SET ColOrder = ColOrder + 1 FROM syscolumns tcols INNER JOIN
sysobjects tojbs ON syscolumns.id = sysobjects.id WHERE tobjs.name =
'Customer' AND ColOrder >= 2
UPDATE tcols SET ColOrder = 2 FROM syscolumns tcols INNER JOIN sysobjects
tojbs ON syscolumns.id = sysobjects.id WHERE tobjs.name = 'Customer' AND
tcols.name = 'CustSex'
Thanks,
Keith