[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to create a temporaray table every time when the procedure is called.

Posted on 2012-09-21
3
Medium Priority
?
352 Views
Last Modified: 2012-09-22
The procedure should check whether the table is existing, if it exists it should
How to create a temporary table every time when the procedure is called,
The table should get deleted first and then recreated every time
0
Comment
Question by:searchsanjaysharma
3 Comments
 
LVL 11

Accepted Solution

by:
rajvja earned 1200 total points
ID: 38421018
if object_id (N'tempdb..#tablename', N'U') is not null
            drop table #tablename;

create #tablename ()
0
 
LVL 19

Assisted Solution

by:Bhavesh Shah
Bhavesh Shah earned 300 total points
ID: 38421099
Hi,

you no need to explicitly drop the temporary table in procedure.
temp Table itself get dropped after completion of execution of procedure.
0
 

Author Closing Comment

by:searchsanjaysharma
ID: 38424575
thanx
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question