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 / madhu sudhan g

Hiiii


in Stored Procedures we cannot create same temp table twice if it is in IF else conditions also

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What methods do you follow to protect from sql injection attack?

612


Are there any preferred steps that need to be taken care of before starting the installation of sql server 2000?

659


How to write character string constants or literals in ms sql server?

637


You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?

645


How to find the source of a table in sql server?

626






What new changes are being made in SQL Server?

674


How are the exceptions handled in sql server programming?

684


Can we join two tables without primary key?

701


What is mean by dml?

638


Suppose we have a table "MyTable" containing 10 rows, what query should be executed to update the odd rows "Salary" as 9000?

665


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?

151


Is it possible to call a stored procedure within a stored procedure?

644


What are magic tables in sql server?

702


How check triggers in sql server?

587


Does index speed up select statements?

668