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 the beast way to write CTE in SQL Server ?
How to find index size for each index on table?
What are the advantages of passing name-value pairs as parameters?
what is the difference between writing data to mirrored drives versus raid5 drives. : Sql server administration
How can we determine what objects a user-defined function depends upon?
What are approximate numeric data types in ms sql server?
Which joins are sql server default?
What is sql server transaction log file?
What is the order in which the sql query is executed?
What is user defined stored procedures?
If you are given access to a SQL Server, how do you find if the SQL Instance is a named instance or a default instance?
Explain how you can deploy an SSRS report?
Define the one-to-one relationship while designing tables.
What should be the fill factor for indexes created on tables? : sql server database administration
How to make a column nullable?