Subject Re: [firebird-support] request for DML SQL feature
Author Tjioe Hian Pin
Thanks a lot SET, I wrote that post w/o preparation & now I see  the syntax I wrote was awful. Your syntax meets my expectation, probably you would like to help us (I'm sure not just me need that feature) posting request in right site :-)

Your tips to detect field position is also very helpful for now, thanks again.

Regards,
Tjioe Hian Pin


On Monday, March 10, 2014 9:41 PM, Svein Erling Tysvær <svein.erling.tysvaer@...> wrote:
 
>Hi everybody, I'm not sure this is a right site to ask for request for DML SQL, but I can stand any critics for this possible wrong post.

>

>I want to request a feature for firebird DML ie:

> ALTER TABLE <table> .. ALTER FIELD POSITION [BEFORE|AFTER] <field>..

>I'm sure this would be a big help in adding new fields to table w/ many many fields coz need not to count the sequence of new field position.


You don’t have to count field position, just issue

select rdb$field_position+1
from rdb$relation_fields
where rdb$relation_name = :TableName
and rdb$field_name = :FieldName

to find where the field currently is placed. Of course, you would have to know whether or not the field you wanted to move should be moved forward or backward and adjust by 1 if necessary, but that is just a minor adjustment.

HTH,
Set