title: Data Masking in SQL Server 2008
body: <p>I'm trying to mask all other ID's when a specific ID is selected. But it will not run. This is what I have so far.</p>
  
  <p>This is my current code:</p>
  
  <pre><code>USE [DB1]
  Declare IDCursor Cursor
      For
          Select ID, Year, Amount, RefreshDate 
          From Table1
          For Update
      Open IDCursor
      Declare @ID int, @Year datetime, @Amount money, @RefreshDate datetime
      Fetch Next From IDCursor 
      Into @ID, @Year, @Amount, @RefreshDate 
      While @@Fetch_Status = 0
  Begin
      If @ID &lt;&gt; 0
      SELECT SUBSTRING(CONVERT(varchar(255), NEWID()), 0, 5)
  
      Else
      Set @ID = 0
  
  End
  Close IDCursor 
  Deallocate IDCursor
  </code></pre>