I get the following error when checking syntax of my stored proc:
Microsoft SQL-DMO (ODBC SQLState: 42S01)
---------------------------
Error 2714: There is already an object named '#TempReps' in the database.
...but the temp table DOESN'T exist!!!!!!! I checked TempDb and it's not there. I even exit out of EM completely and come back and it still throws this error.
Here's the code from the IF block (modified for brevity here):
if @tcSalesRepID <> '' -- get specific sales rep
select c1.cSalesRepID, c1.iMailCompID
into #TempReps
from CallCampaingResponds c1
inner join dbo.TempMailComp t1
on t1.iMailCompID = c1.iMailCompID
group by c1.cSalesRepID, c1.iMailCompID
else -- get all salesreps for given events
select c1.cSalesRepID, c1.iMailCompID
into #TempReps
from CallCampaingResponds c1
inner join dbo.TempMailComp t1
on t1.iMailCompID = c1.iMailCompID
where c1.csalesrepid = @tcSalesRepID
group by c1.cSalesRepID, c1.iMailCompID
Ideas how to overcome this issue? I had the same problem with TempMailComp and just decided to make a real table temporary (in the same schema) and later delete but that's silly...that defeats the whole purpose of the #TempTable idea!
Ideas?
tia!
--Michael
Microsoft SQL-DMO (ODBC SQLState: 42S01)
---------------------------
Error 2714: There is already an object named '#TempReps' in the database.
...but the temp table DOESN'T exist!!!!!!! I checked TempDb and it's not there. I even exit out of EM completely and come back and it still throws this error.
Here's the code from the IF block (modified for brevity here):
if @tcSalesRepID <> '' -- get specific sales rep
select c1.cSalesRepID, c1.iMailCompID
into #TempReps
from CallCampaingResponds c1
inner join dbo.TempMailComp t1
on t1.iMailCompID = c1.iMailCompID
group by c1.cSalesRepID, c1.iMailCompID
else -- get all salesreps for given events
select c1.cSalesRepID, c1.iMailCompID
into #TempReps
from CallCampaingResponds c1
inner join dbo.TempMailComp t1
on t1.iMailCompID = c1.iMailCompID
where c1.csalesrepid = @tcSalesRepID
group by c1.cSalesRepID, c1.iMailCompID
Ideas how to overcome this issue? I had the same problem with TempMailComp and just decided to make a real table temporary (in the same schema) and later delete but that's silly...that defeats the whole purpose of the #TempTable idea!
Ideas?
tia!
--Michael