ssqlserver最容易忽视的数据库知识
-- 1、查询所有表
SELECT name FROM SysObjects Where XType='U' ORDER BY Name;
--
select * from sysobjects
--2、查询表的字段名称
select COLUMN_NAME from information_schema.COLUMNS where table_name='patient';
-- 3、查询表对于字段属性
select b.name as tablename,a.name as columnname,c.name as typename,a.max_length as typelength
from sys.columns a inner join sys.tables b on b.object_id=a.object_id
inner join sys.types c on c.system_type_id=a.system_type_id
where b.name='patient'
order by b.name,a.column_id