on pg.22 of the guide you reference, you can set the "default" value like this:
ALTER TABLE table_name ALTER column_definition SET DEFAULT expr
"default" would be the same as the Auto-Enter Data (in define field)
the 'expr' is the key here. CURTIMESTAMP would be the current time (in SQL functions)
'constant' would be a value that appears in every field, such as 0 or 1 for boolean fields/columns
other functions may work here.
As for making a lookup or calculated value (or calculation), I wouldn't know that to be possible.
Is there some reason to alter the table via SQL instead on in the Define Field dialog?
Thanks for your answer. I want to alter the table via SQL because I want to automate the field creation for many tables instead of clicking through every table each time I want to add a new field. (I took also a look at Apple-Script but it is not possible to create fields with it and it would be working on MacOS only anyway).
If you have a better way to create fields in many tables automatically I am open for it. (Note: The Import of the schemas does not work for me neither, since the tables do already exist and it is still a manual process)
I really hope there is a way to set the calculated value somehow in the SQL alter statement.
I believe I understood that you wanted to CREATE fields. I guess I'm asking why is this necessary? It seems to be a nightmare (from a design perspective) to me. I work in SQL dbs as well as FM, so am trying to understand why this would be necessary (except infrequently and then using the standard definition dialogs).
Is this a USER need?
Perhaps it's time to consider data storage in an EAV style:
or a NoSQL style:
both of which store data less like the table/column methods, but can be flexible enough to allow changes to the "schema" without really changing the definitions of the schema.
Thanks for the discussion! I'm merely trying to get more information so that I (or others on this forum) may assist you with ways you might not have considered.
Thanks for your inputs and your time. In fact I am aware of the mentioned facts. Since I am developing a synchronisation framework for filemaker files I want to generate the necessary fields into the tables of my customers solutions (eg. a sync_uuid field and a sync_modified timestamp field). This would lower the setup time for the synchronisation a lot.
Are you aware that fields can be copied from one table and pasted into another? I have several fields that I use (such as):
... (probably others)
I set them up once with auto-enter as needed. Then I can copy and paste into existing tables or new tables.
Of course some fields (with auto-enter lookups or calculated) may be out-of-context and not copy-paste easily.
Yes, I am also aware of that. But it can only be accomplished if my customer has a FileMaker Pro Advanced license. (And it is still time-consuming if you have to go through all of your tables).
AH! thank you for the clarification. You are trying to set up USER schema changes, with some control via scripting and the ODBC functions.