<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Insert Data From One Table to Another Table &#8211; INSERT INTO SELECT &#8211; SELECT INTO TABLE</title>
	<atom:link href="http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:36:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Andy Lee</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-246879</link>
		<dc:creator><![CDATA[Andy Lee]]></dc:creator>
		<pubDate>Thu, 02 Feb 2012 03:19:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-246879</guid>
		<description><![CDATA[Thanks..It worked..]]></description>
		<content:encoded><![CDATA[<p>Thanks..It worked..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Aisha</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-245816</link>
		<dc:creator><![CDATA[Aisha]]></dc:creator>
		<pubDate>Mon, 30 Jan 2012 22:45:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-245816</guid>
		<description><![CDATA[Hi ,Can anybody know how to compute minimum value in a cube.As while cube uploads it data, it loads zeros at the places of Null ...I want to calculate minimum value excluding these zeros. Thanks]]></description>
		<content:encoded><![CDATA[<p>Hi ,Can anybody know how to compute minimum value in a cube.As while cube uploads it data, it loads zeros at the places of Null &#8230;I want to calculate minimum value excluding these zeros. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Suresh verma</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-243967</link>
		<dc:creator><![CDATA[Suresh verma]]></dc:creator>
		<pubDate>Thu, 26 Jan 2012 10:02:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-243967</guid>
		<description><![CDATA[select * into TABLE2 from TABLE1]]></description>
		<content:encoded><![CDATA[<p>select * into TABLE2 from TABLE1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: trapezi-saloniou</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-241556</link>
		<dc:creator><![CDATA[trapezi-saloniou]]></dc:creator>
		<pubDate>Sat, 21 Jan 2012 01:32:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-241556</guid>
		<description><![CDATA[Hi there very nice website!! Man .. Excellent .. Wonderful .. I will bookmark your blog and take the feeds also?I am glad to find so many helpful information here in the post, we want develop more techniques on this regard, thank you for sharing. . . . . .]]></description>
		<content:encoded><![CDATA[<p>Hi there very nice website!! Man .. Excellent .. Wonderful .. I will bookmark your blog and take the feeds also?I am glad to find so many helpful information here in the post, we want develop more techniques on this regard, thank you for sharing. . . . . .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: egal</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-240654</link>
		<dc:creator><![CDATA[egal]]></dc:creator>
		<pubDate>Thu, 19 Jan 2012 09:06:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-240654</guid>
		<description><![CDATA[where is the problem adding the independent values to the select-part?

INSERT INTO database1.dbo.table (column1, column2, column3, column4)
SELECT column1, column2, 1, &#039;abc&#039; FROM database2.dbo.table]]></description>
		<content:encoded><![CDATA[<p>where is the problem adding the independent values to the select-part?</p>
<p>INSERT INTO database1.dbo.table (column1, column2, column3, column4)<br />
SELECT column1, column2, 1, &#8216;abc&#8217; FROM database2.dbo.table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NAvi</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-234632</link>
		<dc:creator><![CDATA[NAvi]]></dc:creator>
		<pubDate>Tue, 10 Jan 2012 05:49:34 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-234632</guid>
		<description><![CDATA[i want to move xml to sqldatabase they move propely bt every time they fetch the old data also..i want to insert only updated value everytime nt the old 1&#039;s
/My  Code is here
  string xmlfile = Server.MapPath(&quot;~/ResumeFolder/Export1.xml&quot;);
        try
        {
               using (SqlConnection con = new SqlConnection())
{
                con.Open();
                using (DataSet dsTemp = new DataSet())
                {
                    
                    dsTemp.ReadXml(xmlfile);
                    using (DataTable dt =dsTemp.Tables[0])
                    {
                        using (SqlBulkCopy sb = new SqlBulkCopy(con))
                        {
                                sb.BatchSize = 50;
                                sb.DestinationTableName = &quot;TBQUANTITY&quot;;
                                sb.ColumnMappings.Add(&quot;Id&quot;, &quot;Id&quot;);
                                sb.ColumnMappings.Add(&quot;ProductName&quot;, &quot;ProductName&quot;);
                                sb.ColumnMappings.Add(&quot;CategoryName&quot;, &quot;CategoryName&quot;);
                                sb.ColumnMappings.Add(&quot;Country&quot;, &quot;Country&quot;);
                                sb.ColumnMappings.Add(&quot;OrderDate&quot;, &quot;OrderDate&quot;);
                                sb.ColumnMappings.Add(&quot;OrderTime&quot;, &quot;OrderTime&quot;);
                                sb.ColumnMappings.Add(&quot;UnitPrice&quot;, &quot;UnitPrice&quot;);
                                sb.ColumnMappings.Add(&quot;Quantity&quot;, &quot;Quantity&quot;);
                                sb.WriteToServer(dt);
                        }
                    }
                }
            }
           
        }
        catch
        {
          
        }]]></description>
		<content:encoded><![CDATA[<p>i want to move xml to sqldatabase they move propely bt every time they fetch the old data also..i want to insert only updated value everytime nt the old 1&#8242;s<br />
/My  Code is here<br />
  string xmlfile = Server.MapPath(&#8220;~/ResumeFolder/Export1.xml&#8221;);<br />
        try<br />
        {<br />
               using (SqlConnection con = new SqlConnection())<br />
{<br />
                con.Open();<br />
                using (DataSet dsTemp = new DataSet())<br />
                {</p>
<p>                    dsTemp.ReadXml(xmlfile);<br />
                    using (DataTable dt =dsTemp.Tables[0])<br />
                    {<br />
                        using (SqlBulkCopy sb = new SqlBulkCopy(con))<br />
                        {<br />
                                sb.BatchSize = 50;<br />
                                sb.DestinationTableName = &#8220;TBQUANTITY&#8221;;<br />
                                sb.ColumnMappings.Add(&#8220;Id&#8221;, &#8220;Id&#8221;);<br />
                                sb.ColumnMappings.Add(&#8220;ProductName&#8221;, &#8220;ProductName&#8221;);<br />
                                sb.ColumnMappings.Add(&#8220;CategoryName&#8221;, &#8220;CategoryName&#8221;);<br />
                                sb.ColumnMappings.Add(&#8220;Country&#8221;, &#8220;Country&#8221;);<br />
                                sb.ColumnMappings.Add(&#8220;OrderDate&#8221;, &#8220;OrderDate&#8221;);<br />
                                sb.ColumnMappings.Add(&#8220;OrderTime&#8221;, &#8220;OrderTime&#8221;);<br />
                                sb.ColumnMappings.Add(&#8220;UnitPrice&#8221;, &#8220;UnitPrice&#8221;);<br />
                                sb.ColumnMappings.Add(&#8220;Quantity&#8221;, &#8220;Quantity&#8221;);<br />
                                sb.WriteToServer(dt);<br />
                        }<br />
                    }<br />
                }<br />
            }</p>
<p>        }<br />
        catch<br />
        {</p>
<p>        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: happy</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-233009</link>
		<dc:creator><![CDATA[happy]]></dc:creator>
		<pubDate>Sat, 07 Jan 2012 14:37:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-233009</guid>
		<description><![CDATA[hello sir my name is happy.  

Q1. how to create some table backup in sql server 2005
becuase i knew that if full backup use database right click tasks and go for backup, translog backup
Q2. what is use of stroed procedure in sql server. what is main differnce between view and stored proceduure and fuctions
plz sir help me about question]]></description>
		<content:encoded><![CDATA[<p>hello sir my name is happy.  </p>
<p>Q1. how to create some table backup in sql server 2005<br />
becuase i knew that if full backup use database right click tasks and go for backup, translog backup<br />
Q2. what is use of stroed procedure in sql server. what is main differnce between view and stored proceduure and fuctions<br />
plz sir help me about question</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Santosh Pawar</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-223342</link>
		<dc:creator><![CDATA[Santosh Pawar]]></dc:creator>
		<pubDate>Thu, 22 Dec 2011 03:51:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-223342</guid>
		<description><![CDATA[How to copy data from one column to another column in same table but it should update automatic using time of our system.]]></description>
		<content:encoded><![CDATA[<p>How to copy data from one column to another column in same table but it should update automatic using time of our system.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: proyectopracto</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-222063</link>
		<dc:creator><![CDATA[proyectopracto]]></dc:creator>
		<pubDate>Tue, 20 Dec 2011 11:43:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-222063</guid>
		<description><![CDATA[I forgot to add that my database is a SQL Server 2005]]></description>
		<content:encoded><![CDATA[<p>I forgot to add that my database is a SQL Server 2005</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: proyectopracto</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-222062</link>
		<dc:creator><![CDATA[proyectopracto]]></dc:creator>
		<pubDate>Tue, 20 Dec 2011 11:40:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-222062</guid>
		<description><![CDATA[Hi All

I&#039;m inserting Data From One Table to Another in different databases in the same server, after this is done i have to delete the copied data from the source table. The records are selected based on few constraints in the WHERE clause This table has several dependent tables that also have to be moved.

I have chosen the INSERT INTO...SELECT method because:

1) I can monitor errors during the process
2) I can use transactions and error handlers for testing purposes and to ensure all or nothing will be copied.

I&#039;m having the following dilemas because of this choice:

1) Performance is not the best.

2) Where to run the delete operation? A) Right after every single INSERT statement B) After all thousands INSERT statements.

3) If i need to COMMIT/ROLLBACK INSERTs on target table and DELETEs on source tables, I wonder if SQL Server is able to handle both of them within the same TRANSACTION statement, or i have to first finish one transaction and then change database context (USE statement i.e.) to commit the operations in the other database.

In the end, seems that for this kind of problem, the approach i have chosen has a high cost since the numbers of inserts are about 228000 (I&#039;m copying one row along with dependent rows per each iteration of a loop), this makes me wonder if i shouldn&#039;t just copy records from one table at the time, using INSERT INTO... SELECT ...WHERE ID IN (SELECT IDS FROM SOURCE TABLE)]]></description>
		<content:encoded><![CDATA[<p>Hi All</p>
<p>I&#8217;m inserting Data From One Table to Another in different databases in the same server, after this is done i have to delete the copied data from the source table. The records are selected based on few constraints in the WHERE clause This table has several dependent tables that also have to be moved.</p>
<p>I have chosen the INSERT INTO&#8230;SELECT method because:</p>
<p>1) I can monitor errors during the process<br />
2) I can use transactions and error handlers for testing purposes and to ensure all or nothing will be copied.</p>
<p>I&#8217;m having the following dilemas because of this choice:</p>
<p>1) Performance is not the best.</p>
<p>2) Where to run the delete operation? A) Right after every single INSERT statement B) After all thousands INSERT statements.</p>
<p>3) If i need to COMMIT/ROLLBACK INSERTs on target table and DELETEs on source tables, I wonder if SQL Server is able to handle both of them within the same TRANSACTION statement, or i have to first finish one transaction and then change database context (USE statement i.e.) to commit the operations in the other database.</p>
<p>In the end, seems that for this kind of problem, the approach i have chosen has a high cost since the numbers of inserts are about 228000 (I&#8217;m copying one row along with dependent rows per each iteration of a loop), this makes me wonder if i shouldn&#8217;t just copy records from one table at the time, using INSERT INTO&#8230; SELECT &#8230;WHERE ID IN (SELECT IDS FROM SOURCE TABLE)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-218477</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 15 Dec 2011 13:34:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-218477</guid>
		<description><![CDATA[Use three part name

insert into dbname.ownername.table_name(cols)
select cols from table]]></description>
		<content:encoded><![CDATA[<p>Use three part name</p>
<p>insert into dbname.ownername.table_name(cols)<br />
select cols from table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: everythingisinhere</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-218085</link>
		<dc:creator><![CDATA[everythingisinhere]]></dc:creator>
		<pubDate>Thu, 15 Dec 2011 02:16:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-218085</guid>
		<description><![CDATA[how to insert data into another database? How about that? can you please help me.. Thanks]]></description>
		<content:encoded><![CDATA[<p>how to insert data into another database? How about that? can you please help me.. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sudheep</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-209157</link>
		<dc:creator><![CDATA[sudheep]]></dc:creator>
		<pubDate>Fri, 02 Dec 2011 05:29:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-209157</guid>
		<description><![CDATA[Hi,

I am having three tables named like tbl_report1,tbl_report2,tbl_customer .my issue is i want to combine these tables data and structure into one table like tbl_company.is it possible?.if possible in the sense can you please give me the suggesstion.please do the needful.
tbl_report1 columns:
invoiceno(foreign key fk,particulars,quantity,perprice,amount,orderno,compname,invoicedate,ondate,invoiceid.

tbl_report2 columns:
compname,compaddress,invoiceno(primarykey),orderno,invoicedate,ondate,amountstatus,netvat,netamount,tamount



from the above three tables i want to copy their data and structure into tbl_company.how can i proced.]]></description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I am having three tables named like tbl_report1,tbl_report2,tbl_customer .my issue is i want to combine these tables data and structure into one table like tbl_company.is it possible?.if possible in the sense can you please give me the suggesstion.please do the needful.<br />
tbl_report1 columns:<br />
invoiceno(foreign key fk,particulars,quantity,perprice,amount,orderno,compname,invoicedate,ondate,invoiceid.</p>
<p>tbl_report2 columns:<br />
compname,compaddress,invoiceno(primarykey),orderno,invoicedate,ondate,amountstatus,netvat,netamount,tamount</p>
<p>from the above three tables i want to copy their data and structure into tbl_company.how can i proced.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vikas</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-208645</link>
		<dc:creator><![CDATA[vikas]]></dc:creator>
		<pubDate>Thu, 01 Dec 2011 12:59:13 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-208645</guid>
		<description><![CDATA[you can try this code 

update table1 set Designation=(select Designation from table2 where Empid=&#039;value1&#039;) where EmpId=&#039;YourEmpid&#039;]]></description>
		<content:encoded><![CDATA[<p>you can try this code </p>
<p>update table1 set Designation=(select Designation from table2 where Empid=&#8217;value1&#8242;) where EmpId=&#8217;YourEmpid&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dnyanesh Wahiley</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-205779</link>
		<dc:creator><![CDATA[Dnyanesh Wahiley]]></dc:creator>
		<pubDate>Sun, 27 Nov 2011 19:03:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-205779</guid>
		<description><![CDATA[Hello sir...! I have little problem about database in server  2005..!
I have a Table1 and there are 3 columns like, EmpID,EName,Designation..
Designation column is complete NULL.. here i want to add values from different table which is Table 2. there are 2 columns like EmpID and Designation...!
so what will be queary to add Designation values in Table1 from Table2 Designation column on the basis of EmpID!]]></description>
		<content:encoded><![CDATA[<p>Hello sir&#8230;! I have little problem about database in server  2005..!<br />
I have a Table1 and there are 3 columns like, EmpID,EName,Designation..<br />
Designation column is complete NULL.. here i want to add values from different table which is Table 2. there are 2 columns like EmpID and Designation&#8230;!<br />
so what will be queary to add Designation values in Table1 from Table2 Designation column on the basis of EmpID!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: surya</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-184680</link>
		<dc:creator><![CDATA[surya]]></dc:creator>
		<pubDate>Fri, 28 Oct 2011 19:13:04 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-184680</guid>
		<description><![CDATA[HI Pinal,
we are using sql server 2005,actually frequently we have to restore production database to acceptance environment ,sometimes database in acceptance have more tables than prod database. in that case i just use import\export wizard or select into command to transfer extra tables in acceptance to a temporary created database in same server, but while doing that size of the table in temp database is less  than actual one.So ,while looking table structure there is no index&#039;s,primary keys,foreign keys etc. could ypu please post  your suggestion]]></description>
		<content:encoded><![CDATA[<p>HI Pinal,<br />
we are using sql server 2005,actually frequently we have to restore production database to acceptance environment ,sometimes database in acceptance have more tables than prod database. in that case i just use import\export wizard or select into command to transfer extra tables in acceptance to a temporary created database in same server, but while doing that size of the table in temp database is less  than actual one.So ,while looking table structure there is no index&#8217;s,primary keys,foreign keys etc. could ypu please post  your suggestion</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak Rana</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-181841</link>
		<dc:creator><![CDATA[Deepak Rana]]></dc:creator>
		<pubDate>Sat, 22 Oct 2011 05:51:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-181841</guid>
		<description><![CDATA[hi sir how can i send mail by triger]]></description>
		<content:encoded><![CDATA[<p>hi sir how can i send mail by triger</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Collymitch</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-177988</link>
		<dc:creator><![CDATA[Collymitch]]></dc:creator>
		<pubDate>Wed, 12 Oct 2011 14:17:38 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-177988</guid>
		<description><![CDATA[Hey Dave,
It would be great if you could add an update to your post to explain that this will not work if there is a TRIGGER on that table which does not take multirow operations into consideration.  The user can of course consider disabling/re-enabling the trigger as part of their script.

Regards,

Colly]]></description>
		<content:encoded><![CDATA[<p>Hey Dave,<br />
It would be great if you could add an update to your post to explain that this will not work if there is a TRIGGER on that table which does not take multirow operations into consideration.  The user can of course consider disabling/re-enabling the trigger as part of their script.</p>
<p>Regards,</p>
<p>Colly</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ravindra</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-175609</link>
		<dc:creator><![CDATA[Ravindra]]></dc:creator>
		<pubDate>Thu, 06 Oct 2011 08:03:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-175609</guid>
		<description><![CDATA[ur code is work well...
but image datatype it gives an errer..
it&#039;s copies the rows ... but images are stored in Table not displayed in image control......
plz reply ....]]></description>
		<content:encoded><![CDATA[<p>ur code is work well&#8230;<br />
but image datatype it gives an errer..<br />
it&#8217;s copies the rows &#8230; but images are stored in Table not displayed in image control&#8230;&#8230;<br />
plz reply &#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raghav</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-175129</link>
		<dc:creator><![CDATA[Raghav]]></dc:creator>
		<pubDate>Tue, 04 Oct 2011 18:38:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-175129</guid>
		<description><![CDATA[Good One !]]></description>
		<content:encoded><![CDATA[<p>Good One !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darshana</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-172638</link>
		<dc:creator><![CDATA[Darshana]]></dc:creator>
		<pubDate>Wed, 28 Sep 2011 00:11:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-172638</guid>
		<description><![CDATA[using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

namespace Assignment.Classes
{
    public class DBCon
    {
        public static string con = &quot;Data Source=HP-PC;Initial Catalog=AssignmentDB;Integrated Security=True&quot;;
    //s public static string con = &quot;Data Source=192.168.0.3;Initial Catalog=AELANK;User ID=sa;Password=sssa;Connection Timeout = 2000000&quot;;

//public static string con = &quot;Data Source=HASHENDRA-PC\\SQRSERVER;Initial Catalog=AELANK;Integrated Security=True&quot;;
    
    public static SqlConnection conn = new SqlConnection(con);
    public static SqlCommand comm = new SqlCommand();
    public static SqlDataAdapter adapt = new SqlDataAdapter();
    public static DataSet dtset = new DataSet();
    public static string user;
    public static string department;
    public static string custommer;
    public static string selectedDate;
    public static string FromDate;
    public static string ToDate;
    public static string email;
    public static string ddlStateSales;
    public static string ddlStateCus;
    public static string SalseManager;

   
	public DBCon()
	{
		
	}

    public static DataTable SQLDTT(string strSQL)
    {
        conn.Close();
        if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }

        SqlCommand comm = new SqlCommand();
        SqlDataAdapter adapt = new SqlDataAdapter();
        comm.CommandTimeout = 0;
        comm.CommandText = strSQL;
        comm.Connection = conn;
        adapt.SelectCommand = comm;


        DataTable DataTable = new DataTable();
        adapt.Fill(DataTable);




        //comm.CommandText = strSQL; 
        //comm.Connection = conn;
        //adapt.SelectCommand = comm;
        //dtset = new DataSet();
        //adapt.Fill(dtset);
        //conn.Close();
        return DataTable;

    }

    public static DataSet SQLDT(string strSQL)
    {
        conn.Close();
        if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }

        SqlCommand comm = new SqlCommand();
        SqlDataAdapter adapt = new SqlDataAdapter();
        comm.CommandTimeout = 0;
        comm.CommandText = strSQL;
        comm.Connection = conn;
        adapt.SelectCommand = comm;

        
        DataSet dtset = new DataSet();
        adapt.Fill(dtset);




        //comm.CommandText = strSQL; 
        //comm.Connection = conn;
        //adapt.SelectCommand = comm;
        //dtset = new DataSet();
        //adapt.Fill(dtset);
        //conn.Close();
        return dtset;

    }

    public static int GetNumOfRec(string strSQL)
    {
        /// Use for get No of Records in SELECT command
        //try
        //{
            int intResult = -1;
            conn.Close();
            if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }
       
            strSQL = DBCon.SQLFormat(strSQL);
            SqlCommand sqlCmd = new SqlCommand(strSQL, conn);           
            intResult = (int)sqlCmd.ExecuteScalar();
            sqlCmd.Dispose();

            return intResult;
        //}
        //catch (Exception objError)
        //{
        //    //MessageBox.Show(&quot;System Error - &quot; + objError.Message.ToString(), &quot;Application Error&quot;, MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    return -1;
        //}
    }

    public static string SQLFormat(string strSQL)
    {
        strSQL = strSQL.Replace(&quot;\r&quot;, &quot; &quot;);
        strSQL = strSQL.Replace(&quot;\n&quot;, &quot; &quot;);
        strSQL = strSQL.Replace(&quot;\t&quot;, &quot; &quot;);
        strSQL = strSQL.Replace(&quot; &quot;, &quot; &quot;);
        return strSQL;
    }

    public static string SQLER(string strSQL)
    {
        conn.Close();
        if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }

        strSQL = SQLFormat(strSQL);
        SqlCommand sqlCmd = new SqlCommand(strSQL, conn);
        string strResult = sqlCmd.ExecuteScalar().ToString();
        sqlCmd.Dispose();

        return strResult;
    
    }

    public static SqlDataReader DataReader(string strSQL)
    {
        conn.Close();
        if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }
        strSQL = SQLFormat(strSQL);
        SqlCommand sqlCmd = new SqlCommand(strSQL, conn);
        SqlDataReader dataRed = null;
        sqlCmd.CommandTimeout = 0;
        dataRed = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);
        sqlCmd.Dispose();
        return dataRed;      

    }
    public static SqlDataReader oSQLER(string pSQL)
    {
        conn.Close();
        if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }

        SqlDataReader objReader;
        SqlCommand objCommand;
     //   conn.Close();
      //  if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }
        objCommand = new SqlCommand(pSQL, conn);
        objReader = objCommand.ExecuteReader();
        objReader.Read();
        return objReader;
    }


    public static int SQLCX(string strSQL)
    {
        if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }

            strSQL = SQLFormat(strSQL);
            SqlCommand sqlCmd = new SqlCommand(strSQL, conn);
            sqlCmd.CommandTimeout = 0;    
            int intResult = sqlCmd.ExecuteNonQuery();
            sqlCmd.Dispose();

            return intResult;
        }
    public static int SQLCXRemoveRow(string strSQL, string item)
    {
        if (conn.State.ToString() == &quot;Closed&quot;) { conn.Open(); }

        strSQL = SQLFormat(strSQL);
        SqlCommand sqlCmd = new SqlCommand(strSQL, conn);
        sqlCmd.CommandTimeout = 0;
        sqlCmd.Parameters.AddWithValue(&quot;@value&quot;, item);
        int intResult = sqlCmd.ExecuteNonQuery();
        sqlCmd.Dispose();

        return intResult;
    }



   
    }
}]]></description>
		<content:encoded><![CDATA[<p>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Data.SqlClient;<br />
using System.Data;</p>
<p>namespace Assignment.Classes<br />
{<br />
    public class DBCon<br />
    {<br />
        public static string con = &#8220;Data Source=HP-PC;Initial Catalog=AssignmentDB;Integrated Security=True&#8221;;<br />
    //s public static string con = &#8220;Data Source=192.168.0.3;Initial Catalog=AELANK;User ID=sa;Password=sssa;Connection Timeout = 2000000&#8243;;</p>
<p>//public static string con = &#8220;Data Source=HASHENDRA-PC\\SQRSERVER;Initial Catalog=AELANK;Integrated Security=True&#8221;;</p>
<p>    public static SqlConnection conn = new SqlConnection(con);<br />
    public static SqlCommand comm = new SqlCommand();<br />
    public static SqlDataAdapter adapt = new SqlDataAdapter();<br />
    public static DataSet dtset = new DataSet();<br />
    public static string user;<br />
    public static string department;<br />
    public static string custommer;<br />
    public static string selectedDate;<br />
    public static string FromDate;<br />
    public static string ToDate;<br />
    public static string email;<br />
    public static string ddlStateSales;<br />
    public static string ddlStateCus;<br />
    public static string SalseManager;</p>
<p>	public DBCon()<br />
	{</p>
<p>	}</p>
<p>    public static DataTable SQLDTT(string strSQL)<br />
    {<br />
        conn.Close();<br />
        if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }</p>
<p>        SqlCommand comm = new SqlCommand();<br />
        SqlDataAdapter adapt = new SqlDataAdapter();<br />
        comm.CommandTimeout = 0;<br />
        comm.CommandText = strSQL;<br />
        comm.Connection = conn;<br />
        adapt.SelectCommand = comm;</p>
<p>        DataTable DataTable = new DataTable();<br />
        adapt.Fill(DataTable);</p>
<p>        //comm.CommandText = strSQL;<br />
        //comm.Connection = conn;<br />
        //adapt.SelectCommand = comm;<br />
        //dtset = new DataSet();<br />
        //adapt.Fill(dtset);<br />
        //conn.Close();<br />
        return DataTable;</p>
<p>    }</p>
<p>    public static DataSet SQLDT(string strSQL)<br />
    {<br />
        conn.Close();<br />
        if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }</p>
<p>        SqlCommand comm = new SqlCommand();<br />
        SqlDataAdapter adapt = new SqlDataAdapter();<br />
        comm.CommandTimeout = 0;<br />
        comm.CommandText = strSQL;<br />
        comm.Connection = conn;<br />
        adapt.SelectCommand = comm;</p>
<p>        DataSet dtset = new DataSet();<br />
        adapt.Fill(dtset);</p>
<p>        //comm.CommandText = strSQL;<br />
        //comm.Connection = conn;<br />
        //adapt.SelectCommand = comm;<br />
        //dtset = new DataSet();<br />
        //adapt.Fill(dtset);<br />
        //conn.Close();<br />
        return dtset;</p>
<p>    }</p>
<p>    public static int GetNumOfRec(string strSQL)<br />
    {<br />
        /// Use for get No of Records in SELECT command<br />
        //try<br />
        //{<br />
            int intResult = -1;<br />
            conn.Close();<br />
            if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }</p>
<p>            strSQL = DBCon.SQLFormat(strSQL);<br />
            SqlCommand sqlCmd = new SqlCommand(strSQL, conn);<br />
            intResult = (int)sqlCmd.ExecuteScalar();<br />
            sqlCmd.Dispose();</p>
<p>            return intResult;<br />
        //}<br />
        //catch (Exception objError)<br />
        //{<br />
        //    //MessageBox.Show(&#8220;System Error &#8211; &#8221; + objError.Message.ToString(), &#8220;Application Error&#8221;, MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
        //    return -1;<br />
        //}<br />
    }</p>
<p>    public static string SQLFormat(string strSQL)<br />
    {<br />
        strSQL = strSQL.Replace(&#8220;\r&#8221;, &#8221; &#8220;);<br />
        strSQL = strSQL.Replace(&#8220;\n&#8221;, &#8221; &#8220;);<br />
        strSQL = strSQL.Replace(&#8220;\t&#8221;, &#8221; &#8220;);<br />
        strSQL = strSQL.Replace(&#8221; &#8220;, &#8221; &#8220;);<br />
        return strSQL;<br />
    }</p>
<p>    public static string SQLER(string strSQL)<br />
    {<br />
        conn.Close();<br />
        if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }</p>
<p>        strSQL = SQLFormat(strSQL);<br />
        SqlCommand sqlCmd = new SqlCommand(strSQL, conn);<br />
        string strResult = sqlCmd.ExecuteScalar().ToString();<br />
        sqlCmd.Dispose();</p>
<p>        return strResult;</p>
<p>    }</p>
<p>    public static SqlDataReader DataReader(string strSQL)<br />
    {<br />
        conn.Close();<br />
        if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }<br />
        strSQL = SQLFormat(strSQL);<br />
        SqlCommand sqlCmd = new SqlCommand(strSQL, conn);<br />
        SqlDataReader dataRed = null;<br />
        sqlCmd.CommandTimeout = 0;<br />
        dataRed = sqlCmd.ExecuteReader(CommandBehavior.CloseConnection);<br />
        sqlCmd.Dispose();<br />
        return dataRed;      </p>
<p>    }<br />
    public static SqlDataReader oSQLER(string pSQL)<br />
    {<br />
        conn.Close();<br />
        if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }</p>
<p>        SqlDataReader objReader;<br />
        SqlCommand objCommand;<br />
     //   conn.Close();<br />
      //  if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }<br />
        objCommand = new SqlCommand(pSQL, conn);<br />
        objReader = objCommand.ExecuteReader();<br />
        objReader.Read();<br />
        return objReader;<br />
    }</p>
<p>    public static int SQLCX(string strSQL)<br />
    {<br />
        if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }</p>
<p>            strSQL = SQLFormat(strSQL);<br />
            SqlCommand sqlCmd = new SqlCommand(strSQL, conn);<br />
            sqlCmd.CommandTimeout = 0;<br />
            int intResult = sqlCmd.ExecuteNonQuery();<br />
            sqlCmd.Dispose();</p>
<p>            return intResult;<br />
        }<br />
    public static int SQLCXRemoveRow(string strSQL, string item)<br />
    {<br />
        if (conn.State.ToString() == &#8220;Closed&#8221;) { conn.Open(); }</p>
<p>        strSQL = SQLFormat(strSQL);<br />
        SqlCommand sqlCmd = new SqlCommand(strSQL, conn);<br />
        sqlCmd.CommandTimeout = 0;<br />
        sqlCmd.Parameters.AddWithValue(&#8220;@value&#8221;, item);<br />
        int intResult = sqlCmd.ExecuteNonQuery();<br />
        sqlCmd.Dispose();</p>
<p>        return intResult;<br />
    }</p>
<p>    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: idosoujiRidho</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-170220</link>
		<dc:creator><![CDATA[idosoujiRidho]]></dc:creator>
		<pubDate>Wed, 21 Sep 2011 08:25:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-170220</guid>
		<description><![CDATA[Dear Mr.Pinal,

We need your help, we have 3 table : Sales Last Year, Sales Actual, and Sales Target. 

and then we need to get result for new table, the new table is &quot;Sales YTD&quot;,
Sales YTD is cumulative from Sales Actual.

could you give me the query for Sales YTD(Year-To-Date).

[email removed]

Thanks,
Regards.]]></description>
		<content:encoded><![CDATA[<p>Dear Mr.Pinal,</p>
<p>We need your help, we have 3 table : Sales Last Year, Sales Actual, and Sales Target. </p>
<p>and then we need to get result for new table, the new table is &#8220;Sales YTD&#8221;,<br />
Sales YTD is cumulative from Sales Actual.</p>
<p>could you give me the query for Sales YTD(Year-To-Date).</p>
<p>[email removed]</p>
<p>Thanks,<br />
Regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-168346</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 15 Sep 2011 11:23:12 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-168346</guid>
		<description><![CDATA[101 character does not matter. It will now affect the performance. But what is the need of having such long name?]]></description>
		<content:encoded><![CDATA[<p>101 character does not matter. It will now affect the performance. But what is the need of having such long name?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-168321</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 15 Sep 2011 10:29:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-168321</guid>
		<description><![CDATA[Make another server as linked server. Then write this code

insert into table1(col_list)
select col_list from servername.dbname.ownername.table1
where ]]></description>
		<content:encoded><![CDATA[<p>Make another server as linked server. Then write this code</p>
<p>insert into table1(col_list)<br />
select col_list from servername.dbname.ownername.table1<br />
where</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-168320</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 15 Sep 2011 10:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/2007/08/15/sql-server-insert-data-from-one-table-to-another-table-insert-into-select-select-into-table/#comment-168320</guid>
		<description><![CDATA[You can join the respective tables and take needed columns]]></description>
		<content:encoded><![CDATA[<p>You can join the respective tables and take needed columns</p>
]]></content:encoded>
	</item>
</channel>
</rss>

