I am using MS-SQL Server 2014 on Windows 7.
In the database, I currently have a table named "STATUS" where a column is defined like:
DeviceSerial smallint
There are/will be more than 6k records in this table.
Unfortunately some devices were programmed with wrong serial numbers, for example 43776 instead of 4376 (the tech guy typed 7 twice...). Normally, the DeviceSerial value should be in range: 1 - 9999.
Obviously, 43776 is an out-of-range value for a smallint, hence the insert/update operation crashes :(
Well, the question is: In such situation(s), is there a way to do make the sql-server check the inserted/updated value and, if the DeviceSerial value is greater than 9999, put 0 for it? (0 would mean serial number not set or something).