Search code examples
sql-serversql-server-ce

How to Add a default value in SQL server compact?


I need to add default value column in SqlServer Compact....i am new to this SQL server compact so Plz anyone tell me the Solution of this....

Thanks In Advance


Solution

  • You use the DEFAULT constraint when declaring the column.

    See this MSDN article.

    myCol INT NOT NULL DEFAULT (20)
    

    In the example above, the values for column myCol will default to 20.