Another DB question...
We have a function that grabs a random record from a table
using a stored
procedure (MS SQL):
--------------------------------
CREATE PROCEDURE dbo.sp_randomJudge_district
@dist int
AS
-- Create a temporary table with the same structure of
-- the table we want to select a random record from
/* Clean up */
If exists (select * from tempdb.dbo.sysobjects where
substring(name,1,22) =
'##TempRandomJudgeTable')
Drop Table ##TempRandomJudgeTable
CREATE TABLE ##TempRandomJudgeTable
(
...
)
...
GO
--------------------------------
On occasion, we get this error:
Error accessing Database.
There is already an object named '##TempRandomJudgeTable' in
the database.
Microsoft OLE DB Provider for SQL Server
It appears that sometimes the procedure is called before the
temp table is
deleted from the previous call of the function, but the first
part of the
procedure is to check for that, and delete it if it's there.
Hence, I'm a
bit confused.
=================================================================
Win prizes searching google:
http://www.blingo.com/friends?ref=hM72-GU3FWzMFnTqhv-2GE1FNtA