select count(1) from syscolumns where id = object_id('tbname') 或者 select * from syscolumns where id = object_id('tbname') 或 SELECT MAX(colid) FROM syscolumns WHERE id=OBJECT_ID('table')
1: select sum(c.row_count) as datacount from sys.indexes a , sys.objects b , sys.dm_db_partition_stats c where a.[object_id] = b.[object_id] AND b.[object_id] = c.[object_id] AND a.index_id = c.index_id
原文:sql server 查询数据库所有的表名+字段 SELECT * FROM INFORMATION_SCHEMA.columns WHERE TABLE_NAME='Account' SELECT (case when a.colorder=1 then d.name else '' end) as 表名,--如果表名相同就返回空 a.colorder as 字段序号, a.name as 字段名, (case when COLUMNPROPER
SQL Server 查询锁表 select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) as tableName ,* from sys.dm_tran_locks where resource_type='OBJECT' and OBJECT_NAME(resource_associated_entity_id) is not null SQL Server 解锁表 declare @spid int
原文:sql server 查询某个表被哪些存储过程调用 sql server 查询某个表被哪些存储过程调用 select distinct object_name(id) from syscomments where id in (select id from sysobjects where type ='P') and text like'%TableName%' 原文地址:https://www.cnblogs.com/lonelyxmas/p/9491635.html