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 types of replication are supported in sql server?
What is the difference between the application object and session object?
Differentiate between ms sql server reporting services vs crystal reports?
Which tcp/ip port does sql server run on? How can it be changed?
What is implicit cursors?
How to list all tables in the database using odbc_tables()?
Your sql server is running out of disk space. You notice that there are several large files with ldf extensions what are these files?
Define candidate key, alternate key, and composite key.
What is the command used to check locks in microsoft sql server?
Do you know what is openxml in sql server?
What is the parse query button used for?
Why use “nolock” in sql server?
How to check table values in sql server?
what is a transaction and what are acid properties? : Sql server database administration
Can sql servers link to other servers like oracle?