Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-10-22 : 08:20:18
|
| desrie writes "How can I find the temporary table using VB.This is my program ,but it doesn't work.I need you help,please answer me ASAP! Dim resTmpTable As ADODB.Recordset Set resTmpTable = New ADODB.Recordset resTmpTable.CursorLocation = adUseServer If resTmpTable.State = 1 Then resTmpTable.Close resTmpTable.Open " select name from tempdb..sysobjects where name = '#A100'", pConn, adOpenStatic, adLockReadOnly If Not resTmpTable.EOF Then MsgBox resTmpTable.Fields("name").Value, vbOKOnly pConn.Execute "DROP TABLE #A100" End IfThank you very much !" |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2002-10-22 : 08:23:53
|
| Local temporary tables are visible only in the current session from which they are created. It is likely that you created the temp table in another session and can't see it from this one ...Jay White{0} |
 |
|
|
Kevin Snow
Posting Yak Master
149 Posts |
Posted - 2002-10-22 : 13:54:26
|
| If you create a global temporary table ##Tablename, then your table is accessible across sessions.The table is stored in TempDB. You won't find it listed as a table, but there will be an entry in the sysobjects table with column NAME=##Tablename |
 |
|
|
jeroena
Yak Posting Veteran
76 Posts |
Posted - 2002-10-23 : 04:19:19
|
| HiWhy are you accessing temp tables from VB? Sounds like bad application design.Jeroen. |
 |
|
|
royv
Constraint Violating Yak Guru
455 Posts |
Posted - 2002-10-23 : 10:30:41
|
| Well I agree with jeroena, if the application is constantly used, and I'll elaborate on that. We currently have over 300 stored procedures. Accounting asked me to run a query once every quarter. Instead of making another stored procedure and adding to the stored procedure count, I have a VB application for queries like this one that don't require any performance and run less then or equal to 4 times a year. So yes, in general doing this method is bad design, but depending on the situation, other benefits may arise.***************************************Death must absolutely come to enemies of the code! |
 |
|
|
|
|
|
|
|