ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. 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>https://www.aspforums.net:443/Threads/159428/Insert-records-in-multiple-Tables-using-Stored-Procedure-in-SQL-Server/https://www.aspforums.net:443/Threads/159428/Insert-records-in-multiple-Tables-using-Stored-Procedure-in-SQL-Server/Wed, 26 Jun 2019 00:21:00 GMT