Thursday, November 19, 2009

Most of the time, we, developers, creates temp tables in our stored procedures in order to store temporary data. We, sometimes, encounter an issue when we run that stored procedure, we got exception that #temp table already exists and user doesn't get what he wants.



After doing some RnD, i found a solution which really helped me a lot. Please use below TSQL statement(MS SQL SERVER) before you create any temp table.
if object_id('tempdb..#TableName) is not null drop table #TableName
then create your #TableName.
It will definitly help out alot in getting rid of displayed exception.

No comments: