﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / Inserting data with SELECT and UNION statements / 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, 18 Jun 2013 19:25:26 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Inserting data with SELECT and UNION statements</title><link>http://www.sqlservercentral.com/Forums/Topic1410301-391-1.aspx</link><description>Definitely test, then test some more ;-)  Increasing the volume of the data in the batch will have it's own overheard on your transaction log.</description><pubDate>Tue, 22 Jan 2013 21:55:29 GMT</pubDate><dc:creator>MyDoggieJessie</dc:creator></item><item><title>RE: Inserting data with SELECT and UNION statements</title><link>http://www.sqlservercentral.com/Forums/Topic1410301-391-1.aspx</link><description>Cool, thanks for the reply and the links.I'll do some testing and check out the execution plans of the different methods. Seems like using the "Union" method could lessen to impact on the transaction log for large inserts due to it being executed as a single transaction.</description><pubDate>Tue, 22 Jan 2013 21:50:50 GMT</pubDate><dc:creator>ReamerXXVI</dc:creator></item><item><title>RE: Inserting data with SELECT and UNION statements</title><link>http://www.sqlservercentral.com/Forums/Topic1410301-391-1.aspx</link><description>IMHO it's used mostly to save time when writing the code.  It's like saying INSERT this set of data...and also this, oh wait, here's a few more rows to append to the operation, no, wait, I actually have some more...and handles it in more of a "batch style".  As opposed to writing it in more of set-based operation - insert this into that, insert this into that...etc.Both accomplish the same thing however there are performance impacts associated with both. Test.For things like "examples" for SSC or for testing your own code, the UNION ALL approach is kind of the "norm"Not sure this helps much but here's a few links where similar questions have been asked in the past:http://www.ikriv.com/dev/db/SqlInsert/SqlInsert.htmlhttp://www.sqlservercentral.com/Forums/Topic672861-338-1.aspx</description><pubDate>Tue, 22 Jan 2013 20:53:18 GMT</pubDate><dc:creator>MyDoggieJessie</dc:creator></item><item><title>Inserting data with SELECT and UNION statements</title><link>http://www.sqlservercentral.com/Forums/Topic1410301-391-1.aspx</link><description>Hi, Can someone please explain how inserting data with SELECT and UNION statements work, like in the following example;insert student(student_name)select 'abc'unionselect 'pqr'unionselect 'xyz'I know what the result is but I do not understand how this works, or why you would want to do this.... any help,links,further reading appreciated. Thanks.</description><pubDate>Tue, 22 Jan 2013 17:19:50 GMT</pubDate><dc:creator>ReamerXXVI</dc:creator></item></channel></rss>