有逗号,进行判断条件方法 CHARINDEX(','+CONVERT(VARCHAR(50)," + operatedID + ") +',',','+OperatedID) SQL增加一列连续的自增列 select Row_Number() over ( order by getdate() ) as init , * from 表名 查看数据库是否存在该表 方法1 select distinct object_name(id) from syscomments where id in (select id from sysobjects where type ='P') and text like '%Bak%' 方法2 GO SELECT DISTINCT obj.Name 存储过程名, sc.TEXT 存储过程内容 FROM syscomments sc INNER JOIN sysobjects obj ON sc.Id = obj.ID WHERE sc.TEXT LIKE '%' + 'SeatType' + '%' AND TYPE = 'P' GO 查询所有数据库有用到该字段的数据库 EXEC master..SearchProcOrFuncProc @srh = N'mt_community_seat_tbl', @srh1 = N'SeatType', @dbs = N'', @orders = N'dbname, name';