Create Temp Table from a Select Statement in SQL Server

Performing a select into in order to create a table from another table is SQL Server is very straight forward.
SELECT * into #TMP_MY_TEMP_TABLE
select * from MyTable 
If you want to create a table dynamically from a select statement  where you are joining multiple tables just add a table alias in the second select statement.  
SELECT * into #TMP_MY_TEMP_TABLE
(select a.field1, a.field2, a.field3, b.fieldx
 from MyTableA a, MyTableB B
 where a.field1 = b.field1 
 ) TableX -- An Alias is required to perform a SELECT INTO

Call a Batch (.bat) File from ASP.NET

The following code will enable you to call a Batch File from ASP.NET / C#.

There are a few steps you must take before this will work.

1. Create a new Login ID on your machine
2. Change the site Application Pool to run under this new ID
3. Give the ID Read/Write Rights to the folder that contains the .bat file 

Code Snippet:

using System.IO; 
using System.Diagnostics;

HttpContext CTX = HttpContext.Current; 
var BatchFile = "YourBatchFile.bat";

var Path = CTX.Server.MapPath("~/YourFolderHere");
ProcessStartInfo processInfo = new ProcessStartInfo();
processInfo.WorkingDirectory = Path;
processInfo.FileName = BatchFile;
processInfo.UseShellExecute = true;

Process batchProcess = new Process();
batchProcess.StartInfo = processInfo; batchProcess.Start();