title: SQL Error: "There is already an object named XXXX in the database"
body: <p>Here's my query. What I want to do is run this query every week so table <code>PlanFinder.InvalidAwps</code> will have new records. But when I run the query it gives me this error : </p>
  
  <pre><code>There is already an object named 'InvalidAwps' in the database. 
  </code></pre>
  
  <p>I can't change the table name. It has to remain the same. So how can I run this query every week keeping table name as it is?</p>
  
  <pre><code>-------------------------------------
  IF  EXISTS (SELECT * FROM sys.objects  
  WHERE object_id = OBJECT_ID(N'[PlanFinder].[InvalidAwps]')  
  AND type in (N'U')) 
  BEGIN 
        DROP TABLE [PlanFinder].[InvalidAwps] 
  END 
  
  SELECT DISTINCT P.Ndc Ndc, A.Price AwpUnitCost INTO PlanFinder.InvalidAwps
  FROM
      PlanFinder.PlanFinder.HpmsFormulary P
      LEFT JOIN (SELECT Ndc, Price FROM MHSQL01D.Drug.FdbPricing.vNdcPrices 
                 WHERE PriceTypeCode = '01' AND CurrentFlag = 1) A
  ON P.Ndc = A.Ndc 
  WHERE (A.Ndc IS NULL OR A.Price &lt;= 0 OR A.Price IS NULL)
  AND p.Ndc IS NOT NULL 
  ----------------------------------------------
  </code></pre>