Only Issues is on connect Foreign Key Payments Table which is has Payment_Method Varchar (Column) with reference Payment_Methods Table (Payment_Method_ID) . Payment_Method_ID - INT, Primary Key, Auto_Intrement.
Can someone help on this…
CREATE TABLE Payments
(
Payment_ID INT IDENTITY (1,1) PRIMARY KEY,
Client_ID INT NOT NULL,
Invoice_ID INT NOT NULL,
Date DATE NOT NULL,
Payment_Amount DECIMAL(9,2) NOT NULL,
Payment_Method TINYINT NOT NULL,
CONSTRAINT FK_Payments FOREIGN KEY (Client_ID)
REFERENCES Clients (Client_ID),
CONSTRAINT FK_Invoices FOREIGN KEY (Invoice_ID)
REFERENCES Invoices (Invoice_ID),
CONSTRAINT FK_PaymentsPayment_Methods FOREIGN KEY (Payment_Method)
REFERENCES Payment_Methods (Payment_Method_ID)
);
Output:
Msg 1778, Level 16, State 0, Line 73
Column ‘Payment_Methods.Payment_Method_ID’ is not the same data type as referencing column ‘Payments.Payment_Method’ in foreign key ‘FK_PaymentsPayment_Methods’.
Msg 1750, Level 16, State 1, Line 73
Could not create constraint or index. See previous errors.