create procedure proc1 (@a int)
as
begin
if @a=1
create table #temp(a1 int)
else
create table #temp(a1 int)
end
while executeing the above code it shows error
like '#temp already exist' .why it shows an error?
Answer Posted / saravanan p
Since the stored procedure precompiled, we cannot give same
table name in both the If and else part.
It will work if give some other name in else part.
Is This Answer Correct ? | 11 Yes | 2 No |
Post New Answer View All Answers
What is attribute? : sql server analysis services, ssas
What are the advantages of using third-party tools?
Explain powershell included in sql server 2008?
What is it unwise to create wide clustered index keys?
what is raid and what are different types of raid configurations? : Sql server database administration
How sql server executes a statement with nested subqueries?
is it important for a database administrator to understand the operating system and file access? : Sql server administration
What are views in ms sql server?
It is important form e to get the information from log files of applications executed by the task scheduler? Does sql studio save these log files? : sql server management studio
How to use subqueries in the from clause in ms sql server?
Hi, I Created 3 Tables Person(PersID[prkey],Name,Email,Password), Project(ProjName,ProjID[prkey],ProjLeader,ProjManager) & ProjectInvolvement(EntryDate,ProjID[frkey],PersID[frkey],ProjDuration). For this how can i INSERT,UPDATE & DELETE Through PROCEDURE? Please Post the Answer for me. Desai.
How to delete duplicate rows from table except one?
How to use transact-sql statements to access the database engine?
Explain how to use linked server?
what is normalization? : Sql server database administration