ASPForums.Net RSS Feed additions to the content that appears on ASPForums.Net(c) 2019 All rights reserved.Insert records in multiple Tables using Stored Procedure in SQL Server<p>Hi <a class="username" rel="chetan"> chetan</a>,</p> <p>Refer below sample query.</p> <p><span style="text-decoration: underline;"><strong>SQL</strong></span></p> <pre class="brush: sql">CREATE PROCEDURE InsertMultipleTable &nbsp;&nbsp; &nbsp;@Id INT AS BEGIN &nbsp;&nbsp; &nbsp;IF NOT EXISTS(SELECT CustomerId FROM Customers WHERE CustomerId = @Id) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;INSERT INTO Customers VALUES(&#39;Test&#39;,&#39;Test&#39;) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SELECT * FROM Customers &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;IF NOT EXISTS(SELECT CustomerId FROM CustomerTest WHERE CustomerId = @Id) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;INSERT INTO CustomerTest VALUES(&#39;Test1&#39;,&#39;Test1&#39;) &nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;SELECT * FROM CustomerTest END</pre> <p>&nbsp;</p> <p>&nbsp;</p>, 26 Jun 2019 00:21:00 GMT