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
Don’t worry about the column order.
It won’t affect your query. You can control the columns on your query with explicit column lists. It is unnecessary job or task to insert the column in between the existing column.(there is no way to insert your new column between existing columns. You have to copy the data into temp location & recreate a existing table with your desired column order & copy the data from the temp location).
It always best practice to use the column name list rather than * on your select query.
|||Thanks
No comments:
Post a Comment