-2

Why there are temporary table and table variable concepts in SQL server, when both of them provide the same functionality.

As table variable and temporary table uses the temp DB and have almost identical features.

2

2 Answers 2

0

Though they look same, there are signficant differences.

Major differences

  1. You can create indexes on Temp table. But not on table variable.
  2. You can pass table variable as parameter, but that is not the case with temp table.
  3. you can have transactions working on temp table, but not on table variable.

there are other differences. Just google it.

Sign up to request clarification or add additional context in comments.

Comments

0

One major difference is that you can't use temporary tables in user defined functions, but you can use table variables. I would assume that's because of the difference in scope -- and I would assume this is the reason why table variables have been implemented.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.