title: Unable to drop view, due to unfindable dependency
body: <p>I am tracking down a bug in a SQLCMD migration script, when dropping unused objects.</p>
  <p>The error I receive is the following:</p>
  <pre><code>Msg 208, Level 16, State 1, Server XXXXXXXXXXX\XXX_DEV, Procedure vwEmployeeCompleteAll, Line 47
  Invalid object name &quot;vwTeamsLatest&quot;.
  </code></pre>
  <p>The script in question looks like this:</p>
  <pre><code>USE [DatabaseName]
  GO
  
  DROP PROCEDURE IF EXISTS dbo.spPrepareDischarge
  DROP VIEW IF EXISTS ....
  /*a handful of other views being dropped*/
  DROP VIEW IF EXISTS dbo.vwTeamsLatest
  </code></pre>
  <p>Interestingly enough, <code>vwEmployeeCompleteAll</code> has no dependency on <code>vwTeamsLatest</code>.
  At first I traversed the object graph manually a couple of times to verify I did not overlook it in a cascade some levels down and then double checked using ApexSQL Analyzer. Looking at it from both point of views, neither file has a dependency on the other one.</p>
  <p>After this I did a full text search for <code>vwTeamsLatest</code> and it does not appear in any used view, sproc or function.</p>
  <p>Am I interpreting this error message wrong and vwEmployeeCompleteAll is not the right place to go digging?</p>
  <p>The system in use is a SQL Server 2017</p>