Getting Started with Adobe After Effects - Part 6: Motion Blur
This module helps you to share, discuss and learn interview questions and answers of different technologies

Temporary Table Life Span / Scope

May 29 2012 12:00AM by Manjunath C Bhat   

Question

I have a stored procedure like below and have created a temporary table inside it and have not written any drop statement for this Temporary Table. Now when i execute this procedure for first time it will create the temporary table. Now when i run this procedure for second time, will it execute successfully or it will throw and an error stating "Table already exists in database". Test procedure. CREATE procedure [dbo].[testtemptable] as begin create table #testtemptable ( a varchar(10) null ) end

Answer

The stored procedure will execute without any error no matter how many times you run it.

The reason being, when you create a local temporary table, it stays alive for that session and once session is over the temporary table is automatically deleted. When you run a procedure the session begins and it creates the temporary table and when the execution of Stored procedure is completed, the session ends and the table gets deleted.

Read More..   [32134 clicks]

Published under: SQL Server Interview Questions ·  ·  ·  · 


Manjunath C Bhat
102 · 2% · 511
0
Liked
 
0
Asked



Submit

Your Comment


Sign Up or Login to post a comment.

"Temporary Table Life Span / Scope" rated 5 out of 5 by 9 readers
Temporary Table Life Span / Scope , 5.0 out of 5 based on 9 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]