标签:
--获取所有数据库名 SELECT Name FROM Master..SysDatabases ORDER BY Name --获取所有表名 XType=‘U‘:表示所有用户表; XType=‘S‘:表示所有系统表; SELECT Name FROM [GWI-Pay]..SysObjects Where XType=‘U‘ ORDER BY Name --获取表中的字段名 SELECT Name FROM SysColumns WHERE id=Object_Id(‘Order‘) --获取数库所有字段类型 select name from systypes --获取主键字段 SELECT name FROM SysColumns WHERE id=Object_Id(‘Order‘) and colid=(select top 1 keyno from sysindexkeys where id=Object_Id(‘Order‘)) --获取字段类型 select a.name as [column],b.name as type from syscolumns a,systypes b where a.id=object_id(‘order‘) and a.xtype=b.xtype --获取表结构 字段名 类型 长度 select column_name,data_type,character_maximum_length from information_schema.columns where table_name = ‘order‘
标签:
原文地址:http://www.cnblogs.com/crazy29/p/4738894.html