Label:The teammate gave me the statement to modify the data. Always fails to execute. I wonder. For example:Look carefully at this column, and there is nothing special. such as:But it does have a constraint: ' df__his_drug___all_i__04e4bc85 '. Why do we have this constraint???When I finally searched this article, I understood. Because the column ' All_inventory_state ' is assigned a default value when it is
--Requirements change, need to add a foreigner name to the F_username field of the T_login table, the previous set of varchar (10) is not enough, the negotiation decision to change to varchar (30), when executing, the message index ' Uq_f_username ' depends on the column ' F_ UserName '. ALTER
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->
Alter
Table
Name
Alter
Table
-Change table attributesSyntax
Alter
Tab
Note: SQL Server 2005 and later versions are supported. This version is estimated to be not supported (working environment ).
To work, you need to add a new column to the existing SQL Server
Note: SQL Server 2005 and above support. Version estimation is not supported (working environment 2005,2008).To work, you need to add a new column to the existing table in SQL Server an
Note: SQL Server 2005 and above support. Version estimates are not supported (working environment 2005,2008).
To work, you need to add a new column to the existing table in SQL Server
Create a new table (using the structure of the current table) with the new column (s) included.
Execute aINSERT INTO new_table SELECT (column1,..columnN) FROM current_table;
Rename the current table
Rename the new table using the name of the current
exists, the attribute belongs to the current database. If you specify the object type and name, you must also specify the parent object and type. Otherwise, SQL Server produces an error.
Permission
Members of the db_owner and db_ddladmin fixed database roles can add extended attributes to any object. Users can add ext
CodeAs follows:Exec sp_rename 'table name. [original column name] ', 'new column name', 'column'
**************************************** *********************************Transact-SQL reference
Sp_renameChange the name of the user-created object (such as a
Label:To modify the table design of a database, you can use the SQL ALTER TABLE statement, which is used to add, delete, or modify table columns in an existing table. 1>
Common Lisp Object System (CLOS).
CREATE TABLE Films (Code CHARACTER (5) CONSTRAINT Firstkey PRIMARY KEY,Title CHARACTER varying (+) not NULL,Did DECIMAL (3) Not NULL,Date_prod DATE,Kind CHAR (10),Len INTERVAL HOUR to MINUTE);Please see the details: http://www.linuxforum.net/books/postgresNEW/sql-createtable.htm
ALTER TABLE
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.