Quantcast
Channel: Adobe AEM CQ tips » sql server
Viewing all articles
Browse latest Browse all 3

Altering a column: NULL to NOT NULL

$
0
0

Problem

Change column from NULL to NOT NULL in Microsoft SQL Server.

Solution

There are two steps you need to do

  1. First of all, you have to set all ‘NULL’ values to some other value.
    UPDATE [Table] SET [Column]=0 WHERE [Column] IS NULL
  2. After that, you can run this command to change NULL to NOT NULL column
    ALTER TABLE [Table] ALTER COLUMN [Column] INTEGER NOT NULL

Viewing all articles
Browse latest Browse all 3

Trending Articles