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 / gaurav

Because temp is being used by database internally so that it
is same as a system table so this table can't create by user...

Is This Answer Correct ?    1 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A user is a member of the public role and the sales role. The public role has select permission on all the tables. The sales role does not have select permission on some of the tables will the user be able to select from all tables?

521


How to trouble shoot if unable to connect SQL Server

1478


What is a result set object returned by mssql_query()?

575


What is the difference between dbcc indexdefrag and dbcc reindex?

519


What is resultset concur_updatable?

581






How to find out what is the default collation in a database?

621


How to convert a table data in XML format in sql server?

2116


Mention a few common trace flags used with sql server?

540


What is the guest user account in sql server? What login is it mapped to it? : sql server security

580


What are the aggregate and scalar functions?

521


How do you improve the performance of a SQL Azure Database?

115


What do you mean by subquery?

581


What is a trigger and types of a trigger?

564


can SSRS reports Cache results?

113


What is database replication? What are the different types of replication you can set up in sql server?

500