SQL server2008 modifying Column properties

Source: Internet
Author: User
Tags new set
modifying column Properties
You can use the ALTER TABLE statement not only to add new columns and delete columns, but also to modify the properties of a column, for example, from a new set of column names, data types
Length, whether it is empty, you can also set or cancel the primary KEY constraint for a column
When setting column names, data types, lengths, and whether to allow nulls, ALTER TABLE's syntax format:
ALTER TABLE TABLE_NAME
Alter COLUMN COLUMN_NAME New_type_name
Change the Name column data type in the Student records management system database to the nvarchar (20) statement as follows
Use Student performance management system
ALTER TABLE student Information
ALTER column name nvarchar (a) null
Add Delete table column
Using the ALTER TABLE statement, you can also add/remove columns, such as adding the class information column to the course Information table, as follows

Use Student performance management system

Go
ALTER TABLE Course Information
Add class Information Datatime

Use Student performance management system
Go
ALTER TABLE Course Information
Is the drop column mandatory cascade
Cascade means cascade Delete

SQL server2008 modifying Column properties

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.