QOD 22 dec

  • I tried the 'right' answer and it gave me this error:

    Server: Msg 3728, Level 16, State 1, Line 1

    'MyConstraint' is not a constraint.

    The last answer did the trick. Any explanation, anyone?

    Regards,

    Hans Brouwer

    Kind regards,

    Hans Brouwer

    Greetz,
    Hans Brouwer

  • Further more, after creating the table with the script provided in the question, I could not find a constraint in the table. I scripted the table back and this is what I got:

    CREATE TABLE [dbo].[MyTable] (

    [Pk] [int] NOT NULL ,

    [Choice] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL

    ) ON [PRIMARY]

    GO

    No default value...while looking in the table in designmode the constraint was there, and worked.

    I tried this on a desktopversion of SQL Server, sp3. Does this has siomething to do with configuration? I am really curious about this.

    Regards,

    Hans Brouwer

    Kind regards,

    Hans Brouwer

    Greetz,
    Hans Brouwer

  • I don't see anything wrong with this question. I ran the original CREATE TABLE script and it created the table fine, with a default value of 'Old' for the Choice column. I then ran the two ALTER TABLE statements as per the correct answer and the default value for the column changed to 'New' which was the desired effect.

    Edited by - jameslean on 12/22/2003 04:22:52 AM

    -----
    JL

  • I'm puzzled why it's not working for you. I just tested it against 3 machines and it worked each time. The 5th example would work, however it would have a negative effect on your production while data was copied out and back in. That leaves 4 as the only possible answer.

    Brian Knight

    bknight@sqlservercentral.com

    http://www.sqlservercentral.com/columnists/bknight

Viewing 4 posts - 1 through 3 (of 3 total)

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