﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>How to export a SQL View to CSV using VBScript</title><link>http://www.visualbasicscript.com/</link><description /><copyright>(c) VBScript Forum</copyright><ttl>30</ttl><item><title> RE: How to export a SQL View to CSV using VBScript (dm_4ever)</title><description>  I don't see why it wouldn't be possible with the right SQL query. </description><link>http://www.visualbasicscript.com/fb.ashx?m=49638</link><pubDate>Tue, 17 Jul 2007 20:30:33 GMT</pubDate></item><item><title> RE: How to export a SQL View to CSV using VBScript (peachtea)</title><description>  hi there... just a qn to hijack this thread &lt;br&gt;  &amp;nbsp; &lt;br&gt;  is it possible for vb script to pick up certain information from 2 separate access tables and insert them into the 3rd table before export it out to a csv file? &lt;br&gt;  All 3 tables r in the same db &lt;br&gt;  &amp;nbsp; &lt;br&gt;  Thanks in advance :) &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=49637</link><pubDate>Tue, 17 Jul 2007 20:03:57 GMT</pubDate></item><item><title> RE: How to export a SQL View to CSV using VBScript (VBNewbie07)</title><description>  Thanks dm_4ever! &lt;br&gt;  &amp;nbsp; &lt;br&gt;  I'll give it a try. &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=46583</link><pubDate>Thu, 03 May 2007 05:58:18 GMT</pubDate></item><item><title> RE: How to export a SQL View to CSV using VBScript (dm_4ever)</title><description>  Not certain, but you can export to a csv from an Access DB like this... &lt;br&gt;   &lt;br&gt;  &lt;pre class="prettyprint"&gt;
 Option Explicit
 
 Dim strDBPath : strDBPath = "c:\temp\test.mdb"
 Dim strCSVDirPath : strCSVDirPath = "c:\temp\"
 Dim strCSVFileName : strCSVFileName = "CSVExport.csv" 
 Dim strTableName : strTableName = "SomeTable" 
 Dim objConnection : Set objConnection = CreateObject("ADODB.Connection")
 objConnection.Open "Provider = Microsoft.Jet.OLEDB.4.0; " &amp;amp; _
 &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; "Data Source = " &amp;amp; strDBPath&amp;nbsp; 
 Dim commandstring : commandstring = "SELECT * INTO [text;HDR=Yes;Database=" &amp;amp; _
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; strCSVDirPath &amp;amp; "]." &amp;amp; strCSVFileName &amp;amp; _
 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; " FROM " &amp;amp; strTableName
 objConnection.Execute commandstring
 &lt;/pre&gt; &lt;br&gt;   &lt;br&gt;  You might be able to modify this to export from an SQL server...not sure though...&amp;nbsp; You might also just query the Table using ADO and use the GetString method to format the data and write it out to a .csv file. &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=46564</link><pubDate>Wed, 02 May 2007 18:19:12 GMT</pubDate></item><item><title> How to export a SQL View to CSV using VBScript (VBNewbie07)</title><description>  Hi all. &lt;br&gt;  &amp;nbsp; &lt;br&gt;  I would like to know if there is way to export a SQL View to a csv file using VBScript? &lt;br&gt;  &amp;nbsp; &lt;br&gt;  Thank you in advance! &lt;br&gt;   </description><link>http://www.visualbasicscript.com/fb.ashx?m=46549</link><pubDate>Wed, 02 May 2007 12:50:58 GMT</pubDate></item></channel></rss>
