Next, in the previous article, the INFORMATION_SCHEMA view is mentioned in the SQL table structure information query including the primary and Foreign keys and self-growth. In fact, in SQL2005, Microsoft has promoted the use of the INFORMATION_SCHEMA System View instead of using sys Dongdong, of course, there is still a lot of information that can only be queried through the sys view. Here we will query the table result information.
Next, in the previous article, the INFORMATION_SCHEMA view is mentioned in the SQL table structure information query including the primary and Foreign keys and self-growth. In fact, in SQL 2005, Microsoft has promoted the use of the INFORMATION_SCHEMA System View, instead of using sys Dongdong, of course, there is still a lot of information that can only be queried through the sys view. Here we will query the table result information.
Next, in the previous article, the INFORMATION_SCHEMA view is mentioned in the SQL table structure information query including the primary and Foreign keys and self-growth. In fact, in SQL 2005, Microsoft has promoted the use of the INFORMATION_SCHEMA System View, instead of using sys Dongdong, the Hong Kong server and the U.S. server, of course, still have a lot of information that can only be queried through the sys view. Here we take the query table result as an example to illustrate the use of some major INFORMATION_SCHEMA views.
First, we need to query the column information, which requires the [INFORMATION_SCHEMA]. [COLUMNS] System View to query the information of the data column. The SQL is as follows:
View Code
SELECT c. TABLE_SCHEMA, c. TABLE_NAME, c. COLUMN_NAME, c. DATA_TYPE, c. CHARACTER_MAXIMUM_LENGTH, c. COLUMN_DEFAULT, c. IS_NULLABLE, c. NUMERIC_PRECISION, c. NUMERIC_SCALE. c. Hong Kong Space