title: Run this oracle script in SQL Server which uses tables like V$session and V$sql
body: <p>I am trying to make a query which will work similar to this query in SQL Server. I have mentioned the query below. </p>
  
  <pre><code>SELECT count(*)
  FROM v$session session, v$sql sql 
  WHERE sql.sql_id(+) = session.sql_id 
    AND session.type = 'USER' 
    AND session.username='&lt;SCHEMA&gt;';'
  </code></pre>
  
  <p>I found the alternative for <code>V$session</code> table as <code>sys.sysprocesses</code> but what is alternative for <code>V$sql</code> in SQL Server? Or is there any way we can get this query using only <code>sys.sysprocess</code> table in SQL Server?</p>