NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: terryd on July 28, 2014, 11:21:19 PM

Title: MSSQL solution wanted
Post by: terryd on July 28, 2014, 11:21:19 PM
I have a lot of lookup tables which have 2 fields. One is the primary key created as a guid the other is the description.
I want both to be unique so I have set both keys to unique.
The second should be unique because
a.I don't want for example a vehicle registration number to exist twice in the same table
b.Because I want to use Display Description instead of value when using a lookup on a NetWebForm whih requires a unique Description.
In tps the check for duplication takes place on save. That is I can enter a record but only when I save does it check to see if the description already exists
In MSSQL the check takes place on Insert when the value in the record is blank.
This means that in MSSQL 2 people entering 2 different records into a table at the same time will get a duplication message since at that point in time both have a blank value in the description.
What solutions to this problem are there. Hopefully a setting since I don't look forward to reworking a whole bunch of tables with duplication checking functions prior to saving.
Title: Re: MSSQL solution wanted
Post by: kevin plummer on July 28, 2014, 11:59:38 PM
"MSSQL the check takes place on Insert when the value in the record is blank. "

> sure you don't have auto number options switched on in the templates (even if you are not using auto number)? I believe this will try to save the record before the real save.
Title: Re: MSSQL solution wanted
Post by: Bruce on July 29, 2014, 04:49:38 AM
I'm not sure I agree with your statement

>> In MSSQL the check takes place on Insert when the value in the record is blank.

unless you set the options on the Advanced tab of the form to force it to add when the form opens.

Bruce
Title: Re: MSSQL solution wanted
Post by: sukhendu on July 29, 2014, 10:25:34 AM
Just a thought - on insert prime the description with clock() + a random number and then clear it.  And let the user enter the description.