sql-serveroutsystems

Cannot insert duplicate key row in object with unique index . The duplicate key value. The statement has been terminated


I am new to Outsystems and SQL. I am try to create a Bus Application where the entities are enter image description here

When I try to create a new rider with the same name and different Route and bus Id. I get Cannot insert duplicate key row in object 'dbo.OSUSR_6SL_RIDER' with unique index 'OSIDX_OSUSR_6SL_RIDER_4NAME'. The duplicate key value is (ABC). The statement has been terminated. When I check Name field in the database table 'dbo.OSUSR_6SL_RIDER' it is not having the unique identifier set up. Can anybody please help me with this.


Solution

  • Open the Indexes tree under your table. You will find an Index named 'OSIDX_OSUSR_6SL_RIDER_4NAME'.

    Script out that Index and you will see that it is a UNIQUE index on a "name" column that you are trying to create a duplicate value in.

    You must either change that Index to include Route and Bus ID, or you must abandon your attempt to create a new row with a duplicate name.