title: How to alter column from int to Uniqueidentifier in SQL Server 2008
body: <p>I have a table with column "ID" as datatype int. </p>
  
  <pre><code>CREATE TABLE [dbo].[STUDENT]
  (
      [ID] [int] IDENTITY(1,1) NOT NULL,
      [DOB] [datetime] NOT NULL ,
      [NAME] [nvarchar](250) NULL,
      [CLASS] [nvarchar](50) NULL,
  
      CONSTRAINT [PK_STUDENT_DATA] 
           PRIMARY KEY CLUSTERED ([ID] ASC)
                       WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, 
                             IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
                             ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 95) ON [PRIMARY]
  )  ON [PRIMARY]
  </code></pre>
  
  <p>Now I want to change datatype from <code>int</code> to <code>uniqueidentifier</code>. I have deleted constraint <code>PK_STUDENT_DATA</code>. My <code>ALTER</code> statement is </p>
  
  <pre><code>ALTER TABLE dbo.STUDENT COLUMN ID uniqueidentifier
  </code></pre>
  
  <p>I am getting error:</p>
  
  <blockquote>
    <p>Identity column 'HISTORY_ID' must be of data type int, bigint,
    smallint, tinyint, or decimal or numeric with a scale of 0, and
    constrained to be nonnullable.</p>
  </blockquote>