SQL Server Cursors Question:

Download Job Interview Questions and Answers PDF

Explain Temporary table VS Table variable by using Cursor alternative?

MS SQL Server Cursors Interview Question
MS SQL Server Cursors Interview Question

Answer:

Temporary table

This can improve processing speed but consume disk space.

Table variable

Table variable that can be used in stored procedures, functions and batches.
Table variable get destroyed at the end of the stored procedure, function or batch in which it is defined.
Since it can be used in stored procedure, it is compiled once and can be used many times.
You can't create index on the Table variable.
Since you can create index on the temporary table, it is good where data is huge.

Download MS SQL Server Cursors Interview Questions And Answers PDF

Previous QuestionNext Question
Explain the cursor lock types?What is scrollable cursor?