Sybase查询所有表记录数、表大小、指定条数查询

发布时间 2023-10-11 15:22:42作者: yvioo

 

 

表记录数、表大小

select user_name(a.uid) as table_schema,a.name as table_name,SUM(row_count(db_id(), a.id)) table_rows ,data_pages(db_id(), a.id, 0) * (@@maxpagesize) as table_size from dbo.sysobjects a
where a.type = 'U' and a.name = '指定表名' AND user_name(a.uid)='命令空间' GROUP BY user_name(a.uid),a.name 

 

 

查询表字段

SELECT a.name AS col_name, b.name AS data_type FROM syscolumns a inner join systypes b ON a.type = b.type inner join sysobjects c ON a.id = c.id WHERE c.name = '指定表名'  AND c.type = 'U' AND c.uid = USER_ID('命名空间');

 

查询前10条数据

select TOP 10 * FROM [命名空间].[表名]