How can I change the position of a column in a table using sql. If I run the following, the column always gets added to the end. alter table tbl1 add column column11
I would like to use sql to give the exact position i.e. after column 2 or before column 3...
Is this possible in sql?
p.s. Just interested to know if sql is capable of doing such query.
Is there any specific reason you want the column at the particular ordinal position? If you use front end application, there instead of Rs(0), Rs(1), etc, you should use Rs("colName1"),Rs("colName2"),etc. Then ordinal position doesnt matter
It'll give you an idea of what would be involved and why it's not available. There is a sequence number for the columns in the table which could be used to reorder the client access but it shouldn't make any difference so isn't used.
========================================== Cursors are useful if you don't know sql. DTS can be used in a similar way. Beer is not cold and it isn't fizzy.