tools123
11th March 2003, 00:22
What is the impact of changing ( or introducing where none exists) the initial value of a field with domain tcyesno in a table
where data already exists with no initial value?

I am thinking that if the data that exists is converted to the
initial value where applicable (instead of a '0' which it currently is)
,changing the table def for the initial value and runtime with
reconfig should do it. Any suggestions?
Thanks

shah_bs
11th March 2003, 02:52
When I added a new field, with a initial value, and did a convert to runtime DD with reconfigure table, the records were loaded with the initial value.

You may have to try it out to confirm this, but I think what should happen is that, wherever the original record had EMPTY values, the reconfigure will fill in with the initial database default. Wherever the original value was already present, it will be loaded back intact.

tools123
11th March 2003, 03:45
Thanks for the response.I am thinking on the same lines.

lbencic
11th March 2003, 17:21
I think when you add a field, it will add with the initial value. This I am sure of. But, not so sure if you change the initial value of an existing field, I don't think this would change the value of existing records.
You can run a quick sql query / update to change the values if you need.

tools123
12th March 2003, 01:57
Yes, you are right.Since the field was an existing one, the change
did not impact empty values.I had to update them.All the new records are getting the initial value.

One more observation:The runtime with reconfigure option
did not execute the reconfigure of the table.Could be because
this isa custom field / with no references or the very nature of
change.

zardoz
12th March 2003, 13:59
The initial value of a field is a default that is used only when you insert a record without giving a value to that field.
This is used also to set the field to that value when you use the db.set.to.default(tablename) function.
Think of this as a override of the value that you assign initially to a variable: a zero for a numeric field, an empty string to a string field, a zero (or empty) to an enumerate.

In fact, the run to convert dd doesn't run the reconfiguration of the tables because your change doesn't involve the phisical structure of the table itself (adding a reference to a field, a new field, changing the domain type of a field, an index, etc); your change is reflected only in a change in the runtime data dictionary.