NetTalk Central

Author Topic: MSSQL solution wanted  (Read 2921 times)

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
MSSQL solution wanted
« 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.
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: MSSQL solution wanted
« Reply #1 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.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: MSSQL solution wanted
« Reply #2 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

sukhendu

  • Jr. Member
  • **
  • Posts: 92
    • View Profile
    • Email
Re: MSSQL solution wanted
« Reply #3 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.