Select Into Temp Table using Row_Number Over
<p>I am trying to fill a new table with record from a query using the Row_Number Over(Partition in SQL Server.  The code is a cut down version but I get an error near ')'..  The Select statement works ok on its own..  Obviously I am missing something so can anyone advise what I am doing wrong?  Many many thanks as usual..</p>

<p>Derek</p>

<pre><code>Select * into djtest333 from (SELECT TenancyPK,  ROW_NUMBER() OVER(PARTITION BY TenancyPK  ORDER BY TenancyPK) as RowNumber
  FROM Tenancy)
</code></pre>