SQL Add table fields and SQL query tables, all field names for the table

Source: Internet
Author: User

General: ALTER TABLE [table name] add [Field name] Field properties default default is optional parameter increment field: ALTER TABLE [table name] Add field name smallint default 0 Add Number field, int, Default value is 0 alter table [table name] Add field name int default 0 Add Number field, Long integer, default value 0alter table [table name] Add field name single default 0 Add Number field, one type, default Value 0 alter table [table name] Add field name double default 0 Add Numeric field, double type, default value 0alter table [table name] Add field name Tinyint default 0 Add Number field, byte type, The default value is 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 Type field [NULL] optional parameter & Nbsp;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 field size fix to 255 alter table [table name] Add field name the datetime default function increases the date Type field, where the function can be now (), date (), and so on, representing the default value (which is most commonly used, and other properties, which can be referenced by the following data type   Delete field: ALTER TABLE [table name] Drop field name   Modify size of variable-length text field: ALTER TABLE [table name] ALTER field name varchar (N)   Delete table: drop tables [table name]& Nbsp;  sql query table, all field names of the table

SQL SERVER

View all table names:
Select name from sysobjects wheretype= ' U '

All field names for the query table:
Select name from syscolumns whereid=object_id (' table name ')

SELECT * FROM Information_schema.tables
SELECT * FROM Information_schema.views
SELECT * FROM Information_schema.columns

ACCESS


View all table names:
Select name from Msysobjects where type=1 and flags=0

Msysobjects is a system object, which is hidden by default. It can be displayed by tools, options, views, displays, system objects, and so on.

Oracle
Select cname from col where tname= ' Zw_yingyez '

Select column_name from User_tab_columns wheretable_name= ' Zw_yingyez '

Query table field number
Select COUNT (column_name) from User_tab_columns wheretable_name= ' table name ';

SQL Add table fields and SQL query tables, all field names for the table

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.