There are 2 way to view table field information.
1. select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='table name'
* the field is in order according to the table
* have more information about the table
2. select * from table_field_name where table_name='table name'
* the field is not in order according to the table
* less information about the table
create view table_field_name as
SELECT
table_name=sysobjects.name, column_name=syscolumns.name,
datatype=systypes.name, length=syscolumns.length
FROM sysobjects
JOIN syscolumns ON sysobjects.id=syscolumns.id
JOIN systypes ON syscolumns.xtype=systypes.xtype
WHERE sysobjects.xtype='U'
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment