随笔分类 -  SQL

摘要:找出某个型号对应最高版本 SELECT distinct * into #temp1 FROM [fp_db].[dbo].[mktxhglb] where substring(pdctno,2,4) = 'ABWQ' select distinct * into #temp2 from #temp 阅读全文
posted @ 2021-11-25 19:58 顺时针KEY 阅读(108) 评论(0) 推荐(0)
摘要:方法一 --查看sqlserver被锁的表:select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type=' 阅读全文
posted @ 2021-08-04 17:12 顺时针KEY 阅读(9935) 评论(0) 推荐(0)
摘要:查询字段超过50的表名 select table_name as 表名,count(column_name) as 表的总列数 from information_schema.columns N join sys.sysobjects M on N.TABLE_NAME=M.name where M 阅读全文
posted @ 2021-03-04 15:23 顺时针KEY 阅读(181) 评论(0) 推荐(0)