Fastest Way To Add Not Null Columns With Default

  • Question for the group, I need to add two not null columns to a very large Fact table running in SQL Server 2000. I’ve tried a number of different approaches including the default method:

     

    ALTER TABLE FCT_MACHINE_EVNT_DTL ADD [WAS_TERMINAL_SESSION50] [bit] DEFAULT 0 NOT NULL

     

    and the separate update approach:

     

    1. ALTER TABLE FCT_MACHINE_EVNT_DTL  ADD [WAS_TERMINAL_SESSION50] [bit] DEFAULT 0 NULL

     

    2. update FCT_MACHINE_EVNT_DTL set WAS_TERMINAL_SESSION50 = 0

     

    3. ALTER TABLE FCT_MACHINE_EVNT_DTL ALTER COLUMN WAS_TERMINAL_SESSION50 [bit] NOT NULL

     

    All take hours to process.

     

    Has anyone had luck with either approach or using a different method?

     

    If I could add a “with nocheck” to step three above that would help.

     

    Thanks in advance

  • Please do not cross post. See responses here http://qa.sqlservercentral.com/forums/shwmessage.aspx?forumid=146&messageid=394053

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply