<?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/"
		>
<channel>
	<title>Comments on: Excel Macro to Generate SQL Insert</title>
	<atom:link href="http://www.businesshut.com/excel-macros/excel-macro-to-generate-sql-insert/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.businesshut.com/excel-macros/excel-macro-to-generate-sql-insert/</link>
	<description>Technology Consulting for Small Businesses</description>
	<lastBuildDate>Fri, 20 Jan 2012 13:47:09 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Yuvi</title>
		<link>http://www.businesshut.com/excel-macros/excel-macro-to-generate-sql-insert/#comment-202</link>
		<dc:creator>Yuvi</dc:creator>
		<pubDate>Wed, 02 Feb 2011 06:08:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.businesshut.com/?p=100#comment-202</guid>
		<description>Here is the code which will do the job for you.

Sub SQLtoExcel_Data_Import()
Dim ctn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim stSQL As String
Dim wbBook As Workbook
Dim wsSheet As Worksheet
Dim rnStart As Range
Const stADO As String = &quot;Provider=SQLOLEDB.1;Integrated Security=SSPI;&quot; &amp; _
&quot;Persist Security Info=False;&quot; &amp; _
&quot;Initial Catalog=master;&quot; &amp; _
&quot;Data Source=IANBFS119\SQLEXPRESS&quot; &#039;CHANGE THE DATASOURCE
Set wbBook = ActiveWorkbook
Set wsSheet = wbBook.Worksheets(1)
With wsSheet
.Range(&quot;A1:IV65536&quot;).Clear
Set rnStart = .Range(&quot;A1&quot;)
End With
stSQL = &quot;select * from dbo.spt_values where name like &#039;%c&#039;&quot;
Set ctn = New ADODB.Connection
With ctn
.CursorLocation = adUseClient
.Open stADO
.CommandTimeout = 0
Set rst = .Execute(stSQL)
End With
rnStart.CopyFromRecordset rst
RowCount = Application.WorksheetFunction.CountA(Range(&quot;A:A&quot;))
Formating
MsgBox RowCount &amp; &quot; Records Exported!!!&quot;, vbInformation, &quot;User_Info&quot;
rst.Close
ctn.Close
Set rst = Nothing
Set cnt = Nothing
End Sub

Thx
Yuvi</description>
		<content:encoded><![CDATA[<p>Here is the code which will do the job for you.</p>
<p>Sub SQLtoExcel_Data_Import()<br />
Dim ctn As ADODB.Connection<br />
Dim rst As ADODB.Recordset<br />
Dim stSQL As String<br />
Dim wbBook As Workbook<br />
Dim wsSheet As Worksheet<br />
Dim rnStart As Range<br />
Const stADO As String = &#8220;Provider=SQLOLEDB.1;Integrated Security=SSPI;&#8221; &amp; _<br />
&#8220;Persist Security Info=False;&#8221; &amp; _<br />
&#8220;Initial Catalog=master;&#8221; &amp; _<br />
&#8220;Data Source=IANBFS119\SQLEXPRESS&#8221; &#8216;CHANGE THE DATASOURCE<br />
Set wbBook = ActiveWorkbook<br />
Set wsSheet = wbBook.Worksheets(1)<br />
With wsSheet<br />
.Range(&#8220;A1:IV65536&#8243;).Clear<br />
Set rnStart = .Range(&#8220;A1&#8243;)<br />
End With<br />
stSQL = &#8220;select * from dbo.spt_values where name like &#8216;%c&#8217;&#8221;<br />
Set ctn = New ADODB.Connection<br />
With ctn<br />
.CursorLocation = adUseClient<br />
.Open stADO<br />
.CommandTimeout = 0<br />
Set rst = .Execute(stSQL)<br />
End With<br />
rnStart.CopyFromRecordset rst<br />
RowCount = Application.WorksheetFunction.CountA(Range(&#8220;A:A&#8221;))<br />
Formating<br />
MsgBox RowCount &amp; &#8221; Records Exported!!!&#8221;, vbInformation, &#8220;User_Info&#8221;<br />
rst.Close<br />
ctn.Close<br />
Set rst = Nothing<br />
Set cnt = Nothing<br />
End Sub</p>
<p>Thx<br />
Yuvi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Yuvi</title>
		<link>http://www.businesshut.com/excel-macros/excel-macro-to-generate-sql-insert/#comment-201</link>
		<dc:creator>Yuvi</dc:creator>
		<pubDate>Wed, 02 Feb 2011 06:05:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.businesshut.com/?p=100#comment-201</guid>
		<description>Hey this coule possible in connection stn</description>
		<content:encoded><![CDATA[<p>Hey this coule possible in connection stn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Generate SQL Script from Excel</title>
		<link>http://www.businesshut.com/excel-macros/excel-macro-to-generate-sql-insert/#comment-141</link>
		<dc:creator>Generate SQL Script from Excel</dc:creator>
		<pubDate>Sun, 24 Oct 2010 03:57:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.businesshut.com/?p=100#comment-141</guid>
		<description>Hey we have started contest to win Querycell excel add-on by which you can Generate SQL Script from Excel on a single click of mouse.</description>
		<content:encoded><![CDATA[<p>Hey we have started contest to win Querycell excel add-on by which you can Generate SQL Script from Excel on a single click of mouse.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.businesshut.com/excel-macros/excel-macro-to-generate-sql-insert/#comment-60</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Sun, 26 Sep 2010 19:58:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.businesshut.com/?p=100#comment-60</guid>
		<description>There is a number of scripts available to perform this data transformation task. The problem with those scripts that all of them database specific and they do not work with textiles

Advanced ETL processor can generate Insert scripts from any data source including text files
http://www.dbsoftlab.com/generating-insert-statements.html</description>
		<content:encoded><![CDATA[<p>There is a number of scripts available to perform this data transformation task. The problem with those scripts that all of them database specific and they do not work with textiles</p>
<p>Advanced ETL processor can generate Insert scripts from any data source including text files<br />
<a href="http://www.dbsoftlab.com/generating-insert-statements.html" rel="nofollow">http://www.dbsoftlab.com/generating-insert-statements.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Green</title>
		<link>http://www.businesshut.com/excel-macros/excel-macro-to-generate-sql-insert/#comment-36</link>
		<dc:creator>Jason Green</dc:creator>
		<pubDate>Fri, 24 Sep 2010 02:02:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.businesshut.com/?p=100#comment-36</guid>
		<description>Pavithra,

There are many ways to get data from SQL into Excel, so I&#039;m afraid I won&#039;t be much help without more detail on your specific situation.  However, I would generally not use a macro to get the data from the database.  Instead, I&#039;d create a connection using the &quot;From SQL Server&quot; option under the Data tab. (Screenshot: http://screencast.com/t/MTFkODM0N )

I&#039;d pull that data into a &quot;raw data&quot; sheet and would create my dashboard against that sheet.  I find this gives me more options to manipulate my data directly within Excel.

I hope this helps, but let me know if it doesn&#039;t.  If you can provide some more specifics, I&#039;d be happy to follow up.</description>
		<content:encoded><![CDATA[<p>Pavithra,</p>
<p>There are many ways to get data from SQL into Excel, so I&#8217;m afraid I won&#8217;t be much help without more detail on your specific situation.  However, I would generally not use a macro to get the data from the database.  Instead, I&#8217;d create a connection using the &#8220;From SQL Server&#8221; option under the Data tab. (Screenshot: <a href="http://screencast.com/t/MTFkODM0N" rel="nofollow">http://screencast.com/t/MTFkODM0N</a> )</p>
<p>I&#8217;d pull that data into a &#8220;raw data&#8221; sheet and would create my dashboard against that sheet.  I find this gives me more options to manipulate my data directly within Excel.</p>
<p>I hope this helps, but let me know if it doesn&#8217;t.  If you can provide some more specifics, I&#8217;d be happy to follow up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pavithra</title>
		<link>http://www.businesshut.com/excel-macros/excel-macro-to-generate-sql-insert/#comment-20</link>
		<dc:creator>pavithra</dc:creator>
		<pubDate>Wed, 22 Sep 2010 06:38:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.businesshut.com/?p=100#comment-20</guid>
		<description>hello jason, i tried the macro which u mentioned above. its working. now, i have a problem with the same concept. i am trying to write a macro for geting the data from sql data base based on some conditions and storing those data in excel spreed sheet and later on by using excel data we are making dash boards. but i did&#039;nt get the logic and how to implement. please help to write the macro.</description>
		<content:encoded><![CDATA[<p>hello jason, i tried the macro which u mentioned above. its working. now, i have a problem with the same concept. i am trying to write a macro for geting the data from sql data base based on some conditions and storing those data in excel spreed sheet and later on by using excel data we are making dash boards. but i did&#8217;nt get the logic and how to implement. please help to write the macro.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

