title: Deleting rows without CASCADE DELETE?
body: <p>I have a database in SQL Server, where I have one table for customers, and each customer can have multiple bookings, but a booking can belong only to one customer. The point is that I have written an API and then a client side app using WPF, but I just noticed that I cannot delete a customer without actually previously deleting the associated bookings with that customer. My T-SQL looks like this roughly:</p>
  
  <pre><code>SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  CREATE TABLE [dbo].[Customer](
      [Id] [int] IDENTITY(1,1) NOT NULL,
      [FullName] [nvarchar](50) NOT NULL,
      [DateOfBirth] [date] NOT NULL,
      [Phone] [nvarchar](20) NOT NULL,
  PRIMARY KEY CLUSTERED
  (
      [Id] ASC
  ))
  
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  CREATE TABLE [dbo].[Booking](
      [Id] [int] IDENTITY(1,1) NOT NULL,
      [Amount] [decimal](10,2) NOT NULL,
      [CustomerId] [int] NOT NULL,
  PRIMARY KEY CLUSTERED
  (
      [Id] ASC
  ))
  
  ALTER TABLE [dbo].Booking WITH CHECK ADD CONSTRAINT [FK_Booking_Customer] FOREIGN KEY([CustomerId])
  REFERENCES [dbo].[Customer] ([Id])
  GO
  ALTER TABLE [dbo].[Booking] CHECK CONSTRAINT [FK_Booking_Customer]
  GO
  </code></pre>
  
  <p>Then, I have a delete stored procedure defined like this:</p>
  
  <pre><code>CREATE PROCEDURE DeleteCustomer
      @Id int
  AS
  BEGIN
      SET NOCOUNT ON;
      DELETE FROM [dbo].[Customer]
      WHERE Id = @Id
  END
  GO
  </code></pre>
  
  <p>But as I said I cannot delete a customer that has existing bookings. One way is surely to use CASCADE DELETE, but I don't want also the bookings to be deleted if the customer is deleted. Any idea how to overcome the problem or any workarounds?</p>