Unit of Measurement

Hi All

In the Unit of measurement form i have duplicate unitid, can anyone tell me how i can delete those, as due to this whenever i am syncronizing the database, it doesnt gey sync on the Unit table.

please suggest me the solution.

Thanks

Hi,

Have you tried to delete one of the duplicated records by using the RecId.

You should be able to do this from X++ job or SQL.

Regards,

Velislav

Thanks for replying Velislav

Can you give me that job or through SQL how i can delete and i am not getting how to delete from RecId. Could you please elaborate it a little, please

In uOM pcs are defined twice for example, how to delete the duplicated one

thanks

How did you manage to get a duplicate ID in in the first place? You cannot key it so there is presumably an import routine written incorrectly - I would find this out as well, otherwise they will run it again and corrupt it again.

This is most likely caused by data dictionary modification. No data import script should be able to bypass the Unique constraint on the database level.

In my previous post I assumed that there was only one duplicated record. If this is the case a very simple SQL delete statement should do the trick.

delete from tableName

where RecId = 0 – use the RecId of the duplicated record

and DataAreaId = ‘’ – specify the data area ID if applicable

If the delete fails the unique constraint and/or the eprimary index may have to be removed before deleting the duplicated record. In this case it would be a very good idea to backup the table before applying any schema changes :slight_smile: