I want to throw an exception if cardescription
is in table in row with specific @idCar
cardescription
is not PK, and any change in design is not allowed
insert into carsdescription
(description)
value
(@description,@idCar)
Examples:
IDCar | Description
---------------------
1 | nice - this record was in table before.
1 | nice - should throw exception
2 | nice - it is allowed
Carsdescription table:
- ID (PK, int, autoincrement)
- idcar(FK, int)
- Description(varchar)
Cars table:
- Id(int, PK, autoincrement)
- Name(nvarchar(255)