title: Foreign Key Constraint in Stored Procedure - SQL Server
body: <p>I have the following stored procedure, I have two tables here, Movie and Director.  Both need to be updated when a new movie has been created or added.  How do you handle FKs in stored procedures?  The FK in this case is <code>director_id</code>.  It is a primary key in <code>Director</code> but a FK in <code>Movie</code>  Do I need to specify it twice like so?  I am getting conflict errors</p>
  
  <pre><code>CREATE PROCEDURE Book_Book_Creation
      @Book_id_arg DECIMAL(12),    
      @author_id_arg DECIMAL(12),    
      @type_id_arg DECIMAL(12),     
      @title_arg VARCHAR(64),      -
      @copyright_arg DECIMAL(4),   
      @dauthor_id_2_arg DECIMAL(12),    
      @author_fname_arg VARCHAR (64), 
      @author_lname_arg VARCHAR (64)  
  AS
  BEGIN 
      INSERT INTO Book(Book_id, author_id,genre_id, title, copyright)
      VALUES (@author_arg, @author_id_arg,  @type_id_arg, @title_arg, @copyright_arg);
      INSERT INTO Author(author_id, author_fname, author_lname)
      VALUES (@director_id_2_arg, @director_fname_arg, @director_lname_arg)
  END;
  
  EXECUTE Book_Book_Creation 32,32,1,'Tempting',2013,32,'Taylor','Mendez';
  </code></pre>