Why does "alter column set default" fail ??

  • Well, my mind is blown by this one. When testing the command

    alter table CommissionPayment alter column Amount Set Default 0

    in SQL Server Management Studion, it returns the error:

    "Incorrect syntax near the keyword 'Set'."

    What am I missing?

  • ALTER TABLE dbo.CommissionPayment ADD CONSTRAINT [DF_Amount] DEFAULT (0) FOR [Amount]

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Well thanks! That worked. Too bad the BOL is wrong on this one.

  • The syntax your are trying use I believe is from SQL Sever mobile which for some reason has a slightly diffrent syntax for certain commands to do this in sql server you have to use the syntax as shown by John.

     

    hth

     

    David.

     

    PS The sql server mobile stuff quite oftens comes up first in the 2005 bol just to annoy you.

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

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