Hello
I'm new to SQL Server, hence this trivial question. I have an
application in VB 6.0, database- SQL Server 7.0 and I use ADO for
connectivity.
For reporting purpose, I create a global temp table (##) from the vb
application. I know that the table is created, because I try to insert
some value and try to read the value and its there. My question is
1. When I open the Enterprise manager and look in the TempDb section
to look at the tables, I do not see the table I had created. I know
that once you disconnect the table gets deleted, hence, I make sure I
put a breakpoint once I insert all the records. Where do I look to see
the table that got created.
Here is the code (on the air) I had written and it runs fine without
errors.
db.execute "Create table ##Ap_Tmp (cons_code char(6), cust_code
char(6))"
db is my database connection. Because I prefix it with "db" does the
temp table get created in my database?? I'm confused !!
2. Also, could someone give me an example as to how I check to see if
the temporary table that I created exists ??
TIA
Sue..
Tore Bostrup - 30 Jul 2003 06:26 GMT
I don't have SQL Server 7.0 loaded here, but in SQL Server 2000 Query
Analyzer, you can see the global temp tables in the Object Browser under
tempdb User Tables.
Tools > Object Browser > Show/Hide
HTH,
Tore.
> Hello
>
[quoted text clipped - 26 lines]
> TIA
> Sue..
Val Mazur - 30 Jul 2003 11:32 GMT
Hi Sue,
All the temporary tables are listed in tempdb database. You should check
there. I think you could check it same way as you check if regular table
exists - try to execute next kind of statement
SELECT * FROM SYSOBJECT WHERE [NAME]="##Ap_Tmp" AND TYPE ="T"
--
Val Mazur
Microsoft MVP
> Hello
>
[quoted text clipped - 26 lines]
> TIA
> Sue..
Sue - 30 Jul 2003 17:06 GMT
Hello Val
Thanks for your response. But, I have some more questions.
I did check in the tempdb section, under tables and could not see the
temp table "Ap_tmp" that I had created. I know for sure that it got
created as I'm able to access records from there, but can't see it.
The statement you had provided to check if the temp table exists:
SELECT * FROM SYSOBJECT WHERE [NAME]="##Ap_Tmp" AND TYPE ="T"
How do i use it, in the sense, do I create a like a recordset and try
to open this recordset and check for eof and bof or, is there an other
way to do it. Would appreciate if you can give me an example.
Thanks
Sue..
> Hi Sue,
>
[quoted text clipped - 38 lines]
> > TIA
> > Sue..
Val Mazur - 30 Jul 2003 23:29 GMT
Hi Sue,
Yes, you execute that SQL statement and it should return you recordset. In
number of records is greater than 0 then you have that table. If you just
check list of available table from inside Enterprise Manager, you may not
see it.
--
Val Mazur
Microsoft MVP
> Hello Val
>
[quoted text clipped - 57 lines]
> > > TIA
> > > Sue..