V
Vince Apesa
All,
Any ideas why a temp table isn't visible on the same connection? When
I attempt to run the second sql stmt I get Invalid object name
'#tempTable'
I was under the impression the temp table should exists during the
entire session. Here's an example.
----
SqlConnection = new SqlConnection("....");
conn.Open();
SqlCommand cmd = new SqlCommand("select 1 as xyz into #tempTable",
conn);
cmd.ExecuteNonQuery();
cmd = new SqlCommand("select * from #tempTable", conn);
SqlDataReader r = cmd.ExecuteReader();
while (r.Read())
Console.WriteLine(r["xyz"]);
r.Close();
conn.Close();
Any ideas why a temp table isn't visible on the same connection? When
I attempt to run the second sql stmt I get Invalid object name
'#tempTable'
I was under the impression the temp table should exists during the
entire session. Here's an example.
----
SqlConnection = new SqlConnection("....");
conn.Open();
SqlCommand cmd = new SqlCommand("select 1 as xyz into #tempTable",
conn);
cmd.ExecuteNonQuery();
cmd = new SqlCommand("select * from #tempTable", conn);
SqlDataReader r = cmd.ExecuteReader();
while (r.Read())
Console.WriteLine(r["xyz"]);
r.Close();
conn.Close();