title: Visual Studio SQL database, an error occurred while the batch was being executed (Msg 1785)
body: <p>I have created the following table in service based database (Microsoft SQL) of my MS visual studio project:</p>
  
  <pre><code>CREATE TABLE [dbo].[users] (
      [phone_number]   VARCHAR (50) NOT NULL,
      [name]     VARCHAR (50) NOT NULL,
      [picture]  VARCHAR (50) NOT NULL,
      [password] VARCHAR (50) NOT NULL, 
      CONSTRAINT [PK_users] PRIMARY KEY ([phone_number])
  );
  </code></pre>
  
  <p>and after that when I try adding the following table I am getting the error:</p>
  
  <blockquote>
    <p>an error occurred while the batch was being executed</p>
  </blockquote>
  
  <pre><code>CREATE TABLE [dbo].[location] (
      [location_id] INT  NOT NULL PRIMARY KEY IDENTITY (1, 1),
      [sender]      VARCHAR (50) NOT NULL,
      [reciever]    VARCHAR (50) NOT NULL,
      [latitude]    FLOAT (53)   NOT NULL,
      [longitude]   FLOAT (53)   NOT NULL,
      CONSTRAINT [FK_1] FOREIGN KEY ([sender]) REFERENCES [dbo].[users] ([phone_number]) ON DELETE CASCADE ON UPDATE CASCADE,
      CONSTRAINT [FK_2] FOREIGN KEY ([reciever]) REFERENCES [dbo].[users] ([phone_number]) ON DELETE CASCADE ON UPDATE CASCADE
  );
  </code></pre>
  
  <p>There appears no warnings while creating update script and there is also no data already present in the database. I tried recreating everything from scratch but the error persists. What am I possibly doing wrong?</p>
  
  <p><strong>EDIT :</strong> The error disappears if I remove both "ON DELETE CASCADE" and "ON UPDATE CASCADE" from any one of the foreign key constraints, removing in any other combination doesn't helps. what's wrong with those constraints?</p>