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
you notice that the transaction log on one of your databases is over 4gb the size of the data file is 2mb what could cause this situation, and how can you fix it? : Sql server administration
how do you implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql server database administration
What is NOT NULL Constraint in sql server 2012?
How to drop existing indexes in ms sql server?
Can sub report data source be different from that of the parent report?
What is the difference between ddl,dml and dcl commands?
Are there issues when exporting SSRS reports into Microsoft Excel? When my users are trying to export a SSRS report into Microsoft Excel, one or two columns in the report appear to merge together. Why might this be?
What are the advantages of paper records?
How to convert numeric expression data types by assignment operations?
Explain syntax for dropping triggers?
What is BLOCK statements in SQL?
What is ms sql server index?
How to enable tcp/ip protocol on a sql server?
What is the difference between for trigger and after trigger?
What is a covering index?