title: How to handle entity relationships when using a stored procedure to update database?
body: <p>I'm using a stored procedure to update  a holiday booking to a database. The stored procedure is inserting to multiple tables with relationships. How do I handle these relationships in the stored procedure. </p>
  
  <p>Thank you </p>
  
  <pre><code>   CREATE PROCEDURE SPBookingUpdate
  (
  @BookingDate date,
  @TripStartDate date,
  @NumberOfPeople tinyint,
  @CardHolderName char(50),
  @CardNumber char(16),
  @ExpiryMonth char(3),
  @ExpiryYear char (4),
  @SecurityCode char(3),
  @First_Name char (15), 
  @Last_Name char (20), 
  @Email_Address char (70),
  @Phone_Number char(15),
  @TotalDue money,
  @PaymentDate date
  )
  AS BEGIN
  
  INSERT INTO Booking (BookingDate, TripStartDate, NumberOfPeople)
  VALUES(@BookingDate, @TripStartDate, @NumberOfPeople)
  
  INSERT INTO CreditCard (CardHolderName, CardNumber, ExpiryMonth, ExpiryYear, SecurityCode) 
  VALUES(@CardHolderName, @CardNumber, @ExpiryMonth, @ExpiryYear, @SecurityCode)
  
  INSERT INTO Customers (First_Name, Last_Name, Email_Address, Phone_Number)
  VALUES(@First_Name, @Last_Name, @Email_Address, @Phone_Number)
  
  INSERT INTO Payments (TotalDue, PaymentDate)
  VALUES(@TotalDue, @PaymentDate)
  END
  
  
  CREATE TABLE Customers
  (CustomerID int IDENTITY (1,1) NOT NULL PRIMARY KEY,
  First_Name char(15) NOT NULL, 
  Last_Name char (20) NOT NULL,
  Email_Address char(70) NOT NULL,
  Phone_Number char(15) NOT NULL);
  GO
  
  
  CREATE TABLE CreditCard
  (CreditCardID int IDENTITY (1,1) NOT NULL PRIMARY KEY,
  CardHolderName char(50) NOT NULL,
  CardNumber char(16) NOT NULL,
  ExpiryMonth char(3) NOT NULL,
  ExpiryYear char(4) NOT NULL,
  SecurityCode char(3) NOT NULL);
  GO
  
  CREATE TABLE Holidays
  (HolidayID int IDENTITY (1,1) NOT NULL PRIMARY KEY,
  HolidayName char(50) NOT NULL,
  PlaceAvailability int NOT NULL,
  NumberOfDaysOnPackage tinyint NOT NULL,
  PricePerPerson money NOT NULL,
  BriefDescription char(450) NOT NULL )
  GO
  
  CREATE TABLE Booking
  (BookingID int IDENTITY (1,1) NOT NULL PRIMARY KEY,
  HolidayID int NOT NULL REFERENCES Holidays(HolidayID),
  CustomerID int NOT NULL REFERENCES Customers(CustomerID),
  BookingDate date NOT NULL,
  TripStartDate date NOT NULL,
  NumberOfPeople tinyint NOT NULL
  )
  GO
  
  
  
  CREATE TABLE Payments
  (PaymentID int IDENTITY (1,1) NOT NULL PRIMARY KEY,
  BookingID int NOT NULL REFERENCES Booking(BookingID),
  CreditCardID int NOT NULL REFERENCES CreditCard(CreditCardID),
  TotalDue money NOT NULL,
  PaymentDate date NOT NULL
  )
  </code></pre>