-1
I was wondering if it’s possible to disable a Primary key from a table. I’ll explain why you have to disable Prime Key. I have a table B that has a foregein referring to table A, but I need to delete table A without having to delete foregein from table B. Table A was created with 999 record, however, from record 1 to record 35 were created right, more from record 36 to record 998 was requested to delete the reserved record.
the script to create the table
IF EXISTS (SELECT * FROM SYS.TABLES WHERE NAME = 'Tabela A')
BEGIN
delete from Tabela A
INSERT INTO Tabela A VALUES ('001','Administradora de Cartões Sicredi Ltda.',03106213000190)
INSERT INTO Tabela A VALUES ('035','Administradora de Cartões Sicredi Ltda.(filial RS)',03106213000271)
INSERT INTO Tabela A VALUES ('036','resevado',null)
INSERT INTO Tabela A VALUES ('998','revervado',null)
INSERT INTO Tabela A VALUES ('999','Outros',NULL)
END
GO
Can someone help me to delete this table.
What you really need is to remove the Foreign key from table A to table B, no? Since this relation (e.g., field
idA
of table B reference fieldid
from table A), you may remove any elements from table A (assuming there is no other FK relation to that table).– carlosfigueira
Look I don’t know if I got it wrong, but in my view you need to do an update to update Table 'B' with the correct records, that is, the records from 1 to 35. Then you can delete the information you consider wrong in Table 'A' which are 35 to 998.
– Marconi
Value the Marconi tip, was talked with the other programmer and was set that, and better to give an update and then delete the registration from 35 to 998, thanks for the tip.
– krispim