1.in查询条件是list时 <select id="getMultiMomentsCommentsCounts" resultType="int"> select moment_comment_count from tbl_moment_commentCount where mid in <foreach item="item" index="index" collection="list&quo…
--查询表B,把查询到的数据插入临时表#A中,根据表B 的ID 进行排序:表#A中 的 i 字段 由1开始增加排序: SELECT ROW_NUMBER() OVER ( ORDER BY ID ) i,* INTO #A FROM B DECLARE @count INT; SELECT @count=COUNT(1) FROM #A --获取临时表#A 的总数量,用来循环: DECLARE @i INT=1; …
运维sql server的sql总结,包含阻塞语句.等待语句.某个时间段的sql性能查询等等常用sql语句 ##断开库的连接,记得修改库名 USE masterGOALTER DATABASE [DBName] SET SINGLE_USER WITH ROLLBACK IMMEDIATEGO--查看是否还有用户连接SELECT * FROM sys.[sysprocesses] WHERE DB_NAME([dbid])='DBName'GOALTER DATABASE [DBName] SE…