To specify a default value for a column
- Using SQL Server Management Studio
1. In Object Explorer, right-click the table with columns for which you want to change the scale and click Design.
2. Select the column for which you want to specify a default value.
3. In the Column Properties tab, enter the new default value in the Default Value or Binding property.
4. On the File menu, click Save table name.
- Using Transact-SQL
2. On the Standard bar, click New Query.
3. Copy and paste the following example into the query window and click Execute.
ALTER TABLE tablename ADD CONSTRAINT Con_Name DEFAULT 50 FOR columnName ;
NOTE:
1. To enter a text string, enclose the value in single quotation marks ('); do not use double quotation marks (") because they are reserved for quoted identifiers.
2. To enter a numeric default, enter the number without quotation marks around it.
3. To enter an object/function, enter the name of the object/function without quotation marks around it.
Friends, If you like this post, please share with your friends on Facebook and Google+ and recommend us on Google using the g+1 button on the top right hand corner.
No comments:
Post a Comment