 




<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL Server with Mr. Denny &#187; INSERT statement</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/sql-server/tag/insert-statement/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/sql-server</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 17:04:09 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>SQL 2005 Internal Query Error 8623 still unfixed</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/sql-2005-internal-query-error-8623-still-unfixed/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/sql-2005-internal-query-error-8623-still-unfixed/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 11:00:02 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Data integrity]]></category>
		<category><![CDATA[Data Normalization]]></category>
		<category><![CDATA[Error 8623]]></category>
		<category><![CDATA[INSERT statement]]></category>
		<category><![CDATA[Internal Query Processor]]></category>
		<category><![CDATA[KB 940371]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/sql-2005-internal-query-error-8623-still-unfixed/</guid>
		<description><![CDATA[Internal Query Processor Error: The query processor could not produce a query plan. Contact your primary support provider for more information.]]></description>
				<content:encoded><![CDATA[<p>While working on a new part of our production system  we begun getting the following error message back from the SQL Server.</p>
<p><code>Server: Msg 8623, Level 16, State 1, Line 1<br />
Internal Query Processor Error: The query processor could not produce a query plan. Contact your primary support provider for more information.</code></p>
<p>Now I&#8217;ve seen this error before, but it was supposed to have been fixed in <a target="_blank" href="http://support.microsoft.com/kb/940371" title="KB Article 940371">Cumulative Update 3</a> for SQL Server 2005 SP 2 but apparently it hasn&#8217;t been.  I&#8217;m currently running build 3239 which is <a target="_blank" href="http://support.microsoft.com/kb/949095/en-us" title="MS KB 949095">Cumulative Update 7</a>.  (I&#8217;m running the x64 edition.)</p>
<p>The only difference between my query and what&#8217;s documented in the KB article is that I was doing a basic insert statement.</p>
<p> <code>INSERT INTO Table3<br />
 (Table1Id, Table2Id)<br />
 VALUES<br />
 (@Table1Id, @Table2Id) </code></p>
<p>There are obviously no complex queries being run here.  However I did have relational integrity enabled through foreign keys.  I ended up having to remove the foreign key constraints from this table for the insert statement to work correctly.</p>
<p>Hopefully someone finds this info useful.</p>
<p>You can follow along with the Microsoft development teams progress on Microsoft Connect.  It&#8217;s feedback number <a target="_blank" href="https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=332815" title="Microsoft Connect">332815</a>.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/sql-2005-internal-query-error-8623-still-unfixed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New INSERT syntax in SQL Server 2008</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/new-insert-syntax-in-sql-server-2008/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/new-insert-syntax-in-sql-server-2008/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 11:00:25 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[INSERT statement]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[T/SQL]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/new-insert-syntax-in-sql-server-2008/</guid>
		<description><![CDATA[One of the very cool new feature which SQL Server 2008 gives us is an change to the INSERT statement.  Now you can specify multiple rows to insert into a table from a single insert command.]]></description>
				<content:encoded><![CDATA[<p>One of the very cool new feature which SQL Server 2008 gives us is an change to the INSERT statement.  Now you can specify multiple rows to insert into a table from a single insert command.</p>
<p>The syntax is:<br />
<code>CREATE TABLE TableName (Column1 INT, Column2 VARCHAR(10))<br />
INSERT INTO TableName<br />
(Column1, Column2)<br />
VALUES<br />
(1, 'test1'), (2, 'test2'), (3, 'test4')</code></p>
<p>I see this as being a very handy especially when doing an initial data load into a table as you can now load lots of data without having to run a lot of seperate insert statements.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/new-insert-syntax-in-sql-server-2008/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Back To Basics: The INSERT Statement</title>
		<link>http://itknowledgeexchange.techtarget.com/sql-server/back-to-basics-the-insert-statement/</link>
		<comments>http://itknowledgeexchange.techtarget.com/sql-server/back-to-basics-the-insert-statement/#comments</comments>
		<pubDate>Mon, 24 Mar 2008 10:00:22 +0000</pubDate>
		<dc:creator>Denny Cherry</dc:creator>
				<category><![CDATA[Back To Basics]]></category>
		<category><![CDATA[INSERT statement]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[SQL Server 2000]]></category>
		<category><![CDATA[SQL Server 2005]]></category>
		<category><![CDATA[SQL Server 2008]]></category>
		<category><![CDATA[T/SQL]]></category>

		<guid isPermaLink="false">http://itknowledgeexchange.techtarget.com/sql-server/back-to-basics-the-insert-statement/</guid>
		<description><![CDATA[While the SELECT statement is probably the most important command, the INSERT comes in handy.  The INSERT statement is used to do exactly what it sounds like, it inserts data into a table.]]></description>
				<content:encoded><![CDATA[<p>While the SELECT statement is probably the most important command, the INSERT comes in handy.  The INSERT statement is used to do exactly what it sounds like, it inserts data into a table.</p>
<p> There are two ways to insert data into a table.  The first is to pass in each of the values, and the second is to insert the data from a select statement.</p>
<p>For both commands we&#8217;ll be using a new table with this definition.<br />
<code>IF EXISTS (SELECT * FROM sysobjects WHERE name = 'InsertTable')<br />
DROP TABLE InsertTable<br />
GO<br />
CREATE TABLE InsertTable<br />
(id INT,<br />
name sysname)</code></p>
<p>First lets look at passing in the values. With this syntax we specify the names of the columns, and then specify each of the values.</p>
<p><code>INSERT INTO InsertTable<br />
(id, name)<br />
VALUES<br />
(0, 'test')</code></p>
<p>Second we&#8217;ll look at the SELECT statement. There are two ways we can do this as well. The first is to load a single set of values with the select statement. When doing this you can optionally specify the column names or not.</p>
<p><code>INSERT INTO InsertTable<br />
SELECT 0, 'test'</code></p>
<p>The second option with the SELECT statement is to use a SELECT statement from a table. All of the functionally of the SELECT statement is available when using the SELECT statement as part of the INSERT statement.</p>
<p><code>INSERT INTO InsertTable<br />
SELECT id, name<br />
FROM sysobjects</code></p>
<p>We can also do this with some of the more advanced functions of the SELECT statement.</p>
<p><code>INSERT INTO InsertTable<br />
(name, id)<br />
SELECT sysobjects.name, count(*)<br />
FROM sysobjects<br />
JOIN syscolumns ON sysobjects.id = syscolumns.id</code></p>
<p>I hope that you find this post useful. I encourage everyone to open up Books OnLine and read through the information on the INSERT statement. It includes more examples, and some of the other options which are available to you.</p>
<p>Denny</p>
<!-- wpms-network-global-inserts -->]]></content:encoded>
			<wfw:commentRss>http://itknowledgeexchange.techtarget.com/sql-server/back-to-basics-the-insert-statement/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
