Interview Questions

1. How can I add a “NOT NULL” column to an existing article?

Basically you need to add a column with a default constraint. After that the column is made nullable and the constraint can be removed. This worked for transactional publications. For merge it worked but I had to rerun the merge agent after it failed once. The code I used is below:alter table tXXX ADD Salary INT NOT NULL Default 0

go

alter table tXXX alter column Salary INT NULL

go

alter table tXXX drop constraint DF__tXXX__Salary__353DDB1D

go


By Hena Parveen 2 0
Is this helpful? Yes No

Submit an interview question

Submitted questions and answers are subject to review and editing, and may or may not be selected for posting, at the sole discretion of w3Sniff.

Get Started

Comments

Leave a Comment


Check out more interview questions

Based on your skills

MS SQL Server

1658758 1720 23 859

Angular

42393 92 0 46

Wordpress

34278 72 1 36