# Regenerate Data Model Error

**URL:** <https://www.epiusers.help/t/regenerate-data-model-error/53476>\
**Category:** Epicor ERP 10\
**Tags:** sql\
**Created:** [March 12, 2019, 3:36pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476 "2019-03-12T15:36:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://www.epiusers.help/u/Adam)\
**Post date:** [March 12, 2019, 3:36pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/1 "2019-03-12T15:36:43Z")

</div>

Our customer\_ud table has a few fields, with one called ARCollectionNotes\_c. This field is a String x(500). We are needing more space, so I changed it to x(1000). Hit Save. Went into EAC, stopped task agent, stopped application pool, then went to regenerate the data model. I’m now getting the “not synchronized due to errrors” error. I’ve seen some posts on this, but none have provided clarity of what I should do.

I’m running 10.2.100.15 and this error was repeatable on the refreshed Pilot and Test servers. The log referenced in the error is:

```
Start time: 3/12/2019 9:23:44 AM
Database server: EP10SQL1
Database name: EpicorERPPilot
Using Windows authentication: True
User ID: GLCT\epicor
Schemas to include: 
Tables to exclude: Ice.SysSequence, Ice.DBMigrationLog
Generator version: 3.2.100.0
Server version: 3.2.100.9
Folder C:\Users\epicor\AppData\Local\Temp\Epicor\DataModelGenerator\Source is deleted successfully.
Extracting "Epicor.ServiceModel.dll" from "C:\Program Files (x86)\Common Files\Epicor Software\Database Manager Extensions\3.2.100\DataModelGenerator\..\DbMigration.zip" to "C:\Users\epicor\AppData\Local\Temp\Epicor\DataModelGenerator\Deployment\Server\Bin".
Extracting "Epicor.System.dll" from "C:\Program Files (x86)\Common Files\Epicor Software\Database Manager Extensions\3.2.100\DataModelGenerator\..\DbMigration.zip" to "C:\Users\epicor\AppData\Local\Temp\Epicor\DataModelGenerator\Deployment\Server\Bin".
Extracting "EntityFramework.dll" from "C:\Program Files (x86)\Common Files\Epicor Software\Database Manager Extensions\3.2.100\DataModelGenerator\..\DbMigration.zip" to "C:\Users\epicor\AppData\Local\Temp\Epicor\DataModelGenerator\Deployment\Server\Assemblies".
Synchronizing schema changes.
The object 'DF_Customer_UD_ARCollectionNotes_c' is dependent on column 'ARCollectionNotes_c'.
ALTER TABLE ALTER COLUMN ARCollectionNotes_c failed because one or more objects access this column.
ALTER TABLE [Erp].[Customer_UD] ALTER COLUMN [ARCollectionNotes_c] nvarchar(max) NOT NULL  
EXEC Ice.DropColumn N'Erp', N'Customer_UD', N'ARCollectionNotes_c', 1
ALTER TABLE [Erp].[Customer_UD] ADD CONSTRAINT [DF_Customer_UD_ARCollectionNotes_c] DEFAULT '' FOR [ARCollectionNotes_c]

Error Generating the Data Models: The following tables were not synchronized due to errors. Review the log for more detailed information. Tables:
Erp.Customer_UD
```

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [March 12, 2019, 3:38pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/2 "2019-03-12T15:38:24Z")

</div>

You can’t just change the field. You have to delete (with all of the steps) and re-add (with all of the steps) the field. It’s annoying, but it’s how it currently works.

---

<div class="post-metadata">

**Author:** ![Adam](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://www.epiusers.help/u/Adam)\
**Post date:** [March 12, 2019, 3:40pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/3 "2019-03-12T15:40:04Z")

</div>

What do I do about the 100s of entries we already have?

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [March 12, 2019, 3:40pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/4 "2019-03-12T15:40:53Z")

</div>

Capture them somehow, (BAQ to excel) then DMT them back in afterwards.

---

<div class="post-metadata">

**Author:** ![Adam](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://www.epiusers.help/u/Adam)\
**Post date:** [March 12, 2019, 3:42pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/5 "2019-03-12T15:42:15Z")

</div>

That’s incredible. In the future, if I’m unsure about the length of UD string field, should I just default to using ‘max’ instead of trying to put a restraint on length?

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [March 12, 2019, 3:44pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/6 "2019-03-12T15:44:59Z")

</div>

That all depends on what you need. Just think carefully about it when you do it. You can also make another field, and move to that field. Just depends on which way is more work.

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [March 12, 2019, 4:07pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/7 "2019-03-12T16:07:54Z")

</div>

That’s not true. You can increase, but you cannot decrease without truncating.  
I had this same problem–lemme dig up the resolution.

This is your problem: The object ‘DF\_Customer\_UD\_ARCollectionNotes\_c’ is dependent on column ‘ARCollectionNotes\_c’.

What I ended up doing was going into the database and dropping that constraint.  
Then I ran the data model regen, it increased my field for me, and it also added the constraint back in.

 ![image](https://epiusers.help/uploads/default/original/2X/b/b0fe830ec403ba791416a2ca47d8e23e2ffe71f3.png)

**Please test this on a test database before taking my word for it.**

---

<div class="post-metadata">

**Author:** ![Banderson](https://www.epiusers.help/user_avatar/www.epiusers.help/banderson/32/50875_2.png) [@Banderson](https://www.epiusers.help/u/Banderson)\
**Post date:** [March 12, 2019, 4:18pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/8 "2019-03-12T16:18:34Z")

</div>

Good to know. I guess I was assuming since you couldn’t change type, that you couldn’t change size too. Thanks for the correction @hmwillett.

---

<div class="post-metadata">

**Author:** ![Adam](https://www.epiusers.help/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@Adam](https://www.epiusers.help/u/Adam)\
**Post date:** [March 12, 2019, 4:41pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/9 "2019-03-12T16:41:00Z")

</div>

Excellent! Dropping the constraint worked fine.

… now, do I dare regenerating the data model on production, or must I wait until after hours?..

---

<div class="post-metadata">

**Author:** ![hmwillett](https://www.epiusers.help/user_avatar/www.epiusers.help/hmwillett/32/93207_2.png) [@hmwillett](https://www.epiusers.help/u/hmwillett)\
**Post date:** [March 12, 2019, 4:50pm UTC](https://www.epiusers.help/t/regenerate-data-model-error/53476/10 "2019-03-12T16:50:39Z")

</div>

It’s best to do it after hours.
