whorsfall
asked on
ADO.NET code to update a temporary table
Hi,
I have some simple code below and I would like to get some ADO.NET code to update a temporary table. Hopefully using Datasets / data tables.
Thanks,
Ward
I have some simple code below and I would like to get some ADO.NET code to update a temporary table. Hopefully using Datasets / data tables.
Thanks,
Ward
SqlConnection myConn = new SqlConnection("Data Source=localhost\\SQLEXPRESS;Initial Catalog=CarDB;Integrated Security=True;database=CarDB");
string str = "create table #temp1 (col1 int, col2 int);";
// Code to do a dataset to insert some records.
SqlCommand myCommand = new SqlCommand(str, myConn);
myConn.Open();
myCommand.ExecuteNonQuery();
myCommand.CommandText = "drop table #temp1;";
myCommand.ExecuteNonQuery();
ASKER
Hi,
Thanks for your response. Ok I am building a data acquision application which needs to sample data at a high rate and record for later analysis. We estimate we need to store 400 results at 100 times per second.
So I am trying to find the fastest method to achieve this throughput. This why I was thinking about temporary tables.
I would even be happy with something that can run put it all in memory and only take a shoryt amount of time to save to disk.
Ward.
Thanks for your response. Ok I am building a data acquision application which needs to sample data at a high rate and record for later analysis. We estimate we need to store 400 results at 100 times per second.
So I am trying to find the fastest method to achieve this throughput. This why I was thinking about temporary tables.
I would even be happy with something that can run put it all in memory and only take a shoryt amount of time to save to disk.
Ward.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi,
Thanks for the great response - have you tried DB4o it sounds impressive?
thanks,
Ward
Thanks for the great response - have you tried DB4o it sounds impressive?
thanks,
Ward
No I have not tried it myself. But I've heard great things from a friend of a friend
You do not need to CREATE local temporary tables. In stead you just SELECT...INTO them. See the following article for basic tips on usage of SQL Servers local temp tables:
http://weblogs.sqlteam.com/mladenp/archive/2006/11/03/17197.aspx
Many of the operations done by local temporary tables, that only exists in memory for a given session, can be done more effectively by using derived tables directly in the FROM part of your SELECT statement. A strategy many argue can give increased performance. An example of this is given in this aritcle http://www.sql-server-performance.com/articles/per/derived_temp_tables_p1.aspx
Hope this helps you on your quest..?