Wednesday, November 30, 2022

If Column not exist then create

 --SELECT ETinNo FROM Employee


IF NOT EXISTS (

  SELECT * 

  FROM   sys.columns 

  WHERE  object_id = OBJECT_ID(N'[dbo].[Employee]') 

         AND name = 'ETinNo'

)

BEGIN


ALTER TABLE Employee

ADD ETinNo varchar(20);

SELECT 1

END


No comments:

Post a Comment

Screen Record

 Windows Screen Record WindowsKey+ Alt + R Recording Starts.