[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

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