Monday, 5 April 2021

MSSQL - Add column only if it doesn't exist

 Watch this example on YouTube


 

IF COL_LENGTH('dbo.Test3', 'IsValid') is null
Begin
    Alter Table Test3 Add IsValid bit not null default 0
End

Select * from Test3

1 comment:

  1. This article on adding a column in MSSQL only if it doesn't exist is really useful! Just like Better Joy optimizes your gaming, mastering SQL techniques can streamline your database management.

    ReplyDelete