title: What is the equivalent of MySQL @currant := @currank + 1 in MS SQL?
body: <p>This is the main MySQL script I try to convert this following script into MS SQL script. I don't know the equivalent.</p>
  
  <pre><code>SELECT 
          (SELECT 
                  COALESCE(transaction_price, 0)
              FROM
                  (SELECT 
                      COALESCE(transaction_price, 0) AS TRANSACTION_PRICE, COALESCE(actual_size, 0) AS ACTUAL_SIZE, @currank = @currank + 1 AS rank
                  FROM
                      dw_property_detail p, (SELECT @currank:=0) r
                  WHERE
                      land_id = 2 AND transaction_price IS NOT NULL AND flat_type = 'Studio'
                  ORDER BY transaction_price DESC) x
              WHERE
                  x.rank = 1) AS TRAN_S, 
          (SELECT 
                  COALESCE(per_ft_s, 0)
              FROM
                  (SELECT 
                      COALESCE(transaction_price / actual_size, 0) AS PER_FT_S, @currank:=@currank + 1 AS rank
                  FROM
                      dw_property_detail p, (SELECT @currank:=0) r
                  WHERE
                      land_id = 2 AND transaction_price IS NOT NULL AND flat_type = 'Studio'
                  ORDER BY COALESCE(transaction_price / actual_size, 0) DESC) x
              WHERE
                  x.rank = 1) AS PER_FT_S
  </code></pre>
  
  <p>What is the equivalent of <code>@currank := @currank + 1</code> and <code>SELECT @currank := 0</code>? </p>