MSSQL database Add, modify, delete fields

Source: Internet
Author: User
Tags mssql

General: ALTER TABLE [table name] add [field name] field attribute default default value is optional parameter

Add field: ALTER TABLE [table name] Add field name smallint default 0 Add Number field, Integer, default value 0 ALTER TABLE [table name] Add field name int default 0 Add Number field, Long integer, default value is 0a Lter table [table name] Add field name single default 0 Add a number field, one type, the default value is 0 ALTER TABLE [table name] Add field name double default 0 Increase Number field, double type, default value is 0alte R table [table name] Add field name Tinyint default 0 increment Number field, byte type, default value 0 ALTER TABLE [table name] Add field name text [NULL] Add Memo field, [NULL] optional parameter ALTER TABLE [Table name] Add field name MEMO [NULL] Add Memo field, [NULL] optional parameter ALTER TABLE [table name] Add field name varchar (n) [null] increase variable length text type field size N (1~255) ALTER TABLE [Table name] Add field name char [null] increase fixed length text Type field 255 ALTER TABLE [table name] Add field name Datetime default function increment date Type field where function can be now (), date (), table The default values (above are the most commonly used, and other properties, you can refer to the following data type description) Delete the field: ALTER TABLE [table name] Drop field name Modify the size of the text field: ALTER TABLE [table name] ALTER field name varchar (N) Delete Table: Drop table [table name]
Alter TableCategoryAddIncreasemonthvarchar(Ten)NULLAlter TableCategoryAddIncreasevaluedecimal( -,2)default 0Alter TableCategoryAddReducemonthvarchar(Ten)NULLAlter TableCategoryAddReducevaluedecimal( -,2)default 0

MSSQL database Add, modify, delete fields

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.