• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 347
  • Last Modified:

Create temporary table resident in the RAM memory

Hello to the sql server expert,
Pls advise, if there is a way to create a temporary table, resident in the RAM memory to accelerate calculation (save I/O access)?
Thank you,
Ygnd
0
ygnd
Asked:
ygnd
  • 3
  • 2
2 Solutions
 
chapmandewCommented:
You can use a table variable, and it will stay in memory so long as it doesn't grow too large.

declare @table TABLE
(
fld1 int
)

insert into @table
select 1


select * from @table
0
 
adatheladCommented:
You can also use a standard temp table - the data will stay in memory in the same circumstances as a TABLE variable...typically if there isn't a large amount of data.

Typically, you'd go for TABLE variable if the number of records is low....but they still reside in tempdb as a normal temp table does. However, TABLE variables do have limitations that a temp table doesn't - i.e. SELECT INTO... and INSERT...EXEC... statements cant be used to populate a table variable (sql 2005 you can INSERT..EXEC..). Also, you can't explicitly create indexes on TABLE variables which may be handy to improve performance depending on your exact scenario.
0
 
chapmandewCommented:
Ah yes...BUT sql server creates statistics for temp tables...not table variables....so there is a touch more overhead in creating them.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ygndAuthor Commented:
Thank you,
How can I make the table variable from the sql environment known in the VBA environment where my main loop is?
0
 
chapmandewCommented:
Thats a new question....
0
 
ygndAuthor Commented:
I lunch a new question
Pls see if you can help.
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now