Temporary Table???

casey

Registered User.
Local time
Today, 00:05
Joined
Dec 5, 2000
Messages
448
I would like to create a "global" temp table that can be viewed by all users. The syntax is:
Create [TEMPORARY] TABLE tablename (field type)

QUESTION1:
When I put the optional [TEMPORARY] in, I get a syntax error...
Create [TEMPORARY] TABLE t (ID int)
I've tried...
Create TABLE [t] (ID int)
Is that the same as doing this???
Create TABLE t (ID int)

Can someone clear up my syntax?

QUESTION2:
If i can create a temp table when does the table go away? When I close access? Do I have to delete it?

Can someone clear this up? Thanks.
 
You're using CREATE as if this is straight SQL, not Access SQL. You'd use a MAKE TABLE to make a table and then on the DB's Close Event, you'd delete that table (DoCmd.DeleteObject).
 
Thanks for your reply.

Hmmm. I thought I got this syntax from Access help. Wierd. I'll have to check that again.

Still confused though...Are Access temp tables different than say, SQL Server temp tables w/ in SQL you put a ## in front of the name to make it a temp? Can you give me an example of how in Access a "create table" statement for a temp is different than a regular table? Is there a switch that differentiates it from a regular table or in Access are temporary tables merely regular tables? Because it "looks" like they're generated the same way. Does that make any sense?

I hope someone can shed some light on this. I'm thinking that this shouldn't be this difficult. If there's a good reference to this that would help too.
 
Yes, it is in the doc, but as far as I know, it isn't supported. http://office.microsoft.com/en-us/access/HP010322201033.aspx

Edit: I think you'll need to create the the table, then drop it afterwards - both this, or keeping a "permanent" temp table, which you only delete the records in, could easily be characterized as an exercise in bloating. The [brackets] are only necessary, I think, if there are special characters or space in the names.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom