title: SQL Server stored procedure to insert in multiple tables
body: <p>I have 2 tables, <code>custlogin</code> and <code>custinfo</code>:</p>
  
  <p><code>custlogin</code>:</p>
  
  <pre><code>custid int primary key auto notnull
  custusename varchar(25)
  custpassword varchar(50)
  </code></pre>
  
  <p><code>custinfo</code>:</p>
  
  <pre><code>custid foriegnkey custlogin.custid ondelete set NULL
  custfirstname varchar(25)
  custlastname  varchar(25)
  custaddress   varchar(100)
  </code></pre>
  
  <p>I want to write a stored procedure which will insert into both tables</p>
  
  <p>More precisely, insert into <code>custlogin</code> with <code>custusername custpassword</code>, which would return <code>custid</code> for use as foreign key for <code>custinfo</code>.</p>
  
  <p>I have searched much but I didn't find any solution.</p>