﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by Narayana Raghavendra / Article Discussions / Article Discussions by Author  / Multiple Table Insert / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Tue, 21 May 2013 18:16:22 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Multiple Table Insert</title><link>http://www.sqlservercentral.com/Forums/Topic18257-125-1.aspx</link><description>I have made a copy of Narayana's sproc on my Northwind db. Also, I've made two copies of Employees table calling them Employees1 and Employee2.  When I exec the sp_multi_inserts sproc on Northwind database I get the following error:Msg 156, Level 15, State 1, Line 2Incorrect syntax near the keyword 'SELECT'.Execute statement looks as follows:USE NorthwindGODECLARE @DELIMITER AS VARCHAR(200)DECLARE @INSERT_PART AS VARCHAR(2000)SET @DELIMITER = 'ZZZYYYXXX'SET @INSERT_PART = 'WHEN EMPLOYEEID &amp;lt; 5' + @DELIMITER + 'INTO EMPLOYEES1 (LASTNAME, FIRSTNAMEVALUES (LASTNAME, FIRSTNAME)' + @DELIMITER + 'WHEN EMPLOYEEID &amp;gt;4' + @DELIMITER + 'INTO EMPLOYEES2 (LASTNAME, FIRSTNAME) VALUES (LASTNAME, FIRSTNAME)'EXEC SP_MULTI_INSERTS 'SELECT EMPLOYEEID, LASTNAME, FIRSTNAME FROM EMPLOYEES', @INSERT_PART, @DELIMITER, ''What is wrong with how I'm executing the sproc?</description><pubDate>Mon, 19 Dec 2011 18:11:09 GMT</pubDate><dc:creator>KoldCoffee</dc:creator></item><item><title>RE: Multiple Table Insert</title><link>http://www.sqlservercentral.com/Forums/Topic18257-125-1.aspx</link><description>I have problem with store procedure, I cant use strord procedure in my project.....SO can u tell me how to insert multiple table by code not procedure.....</description><pubDate>Fri, 22 Feb 2008 22:11:48 GMT</pubDate><dc:creator>Nilesh-637319</dc:creator></item><item><title>RE: Multiple Table Insert</title><link>http://www.sqlservercentral.com/Forums/Topic18257-125-1.aspx</link><description>Thanks for code and explanation. I guess i could put the conditions in a separate table and use the data to create the parameters required for this stored procedure.Edited by - rajenshah on 11/18/2003  02:28:04 AM</description><pubDate>Tue, 18 Nov 2003 02:27:00 GMT</pubDate><dc:creator>rajenshah</dc:creator></item><item><title>Multiple Table Insert</title><link>http://www.sqlservercentral.com/Forums/Topic18257-125-1.aspx</link><description>Comments posted to this topic are about the content posted at &lt;A HREF=http://www.sqlservercentral.com/columnists/nraghavendra/multipletableinsert.asp&gt;http://www.sqlservercentral.com/columnists/nraghavendra/multipletableinsert.asp&lt;/A&gt;</description><pubDate>Sun, 16 Nov 2003 00:00:00 GMT</pubDate><dc:creator>Raghavendra Narayana</dc:creator></item></channel></rss>