How to make change in database without having a clear primary key? [closed]

2

I need a method to do data change in a SQL Server table.

According to my client, all the table data can be changed. By having this possibility, I am without a fixed and unique reference for the bank to know which data will be changed.

UPDATE tabela SET campo = 1 
WHERE outro_campo = 5

My client suggested creating an on-screen code, which would be invisible to the user, for the bank to use as a change reference, but to be invisible, the user could not insert it, and to display this code when the screen is open, it does not, because there is no data in the fields to use a SELECT.

    
asked by anonymous 23.03.2016 / 15:38

2 answers

2

A basic technique of creating tables in a database is to have a ID column as the primary key, so the data is free to work as you want. This identifier that will obviously be unique and self-incrementing is required for the application but not for the user. In general the user does not even know that it exists, it is absolutely internal. Example:

ID INT IDENTITY(1,1) NOT NULL  PRIMARY KEY
    
23.03.2016 / 15:43
0

The Id is for internal control of your code with the bank ... you do not need to pass this or something of the kind to the user.

If it will change something from the bank, it needs to know what to change, your code and bank will know what to change by the Id.

    
23.03.2016 / 15:54