常用SQL
1 --选出相同行 2 SELECT * 3 FROM I_KHXXGZSJWH a 4 WHERE ( ( SELECT COUNT(*) 5 FROM I_KHXXGZSJWH 6 WHERE KEHBM = a.KEHBM 7 ) > 1 ) 8 ORDER BY KEHBM DESC 9 10 11 --选出某列 求和 12 SELECT SUM(LJKPJE) from I_KPXX WHERE WBSYS='S-201401012.A'; 13 14 15 --删除流程脚本 16 begin 17 use H3Cloud 18 delete from OT_InstanceContext 19 delete from OT_Token 20 delete from OT_WorkItem 21 delete from OT_Attachment 22 DELETE FROM [dbo].[I_电脑信息更新后子表] 23 DELETE FROM [dbo].[I_电脑信息更新前子表] 24 DELETE FROM [dbo].[I_机房硬件更新后子表] 25 DELETE FROM [dbo].[I_机房硬件更新前子表] 26 DELETE FROM [dbo].[I_加班备案记录_GROUP1] 28 end 30 begin 31 use H3 32 delete from dbo.ActivityMap 33 end
--查询表objectID字段的最大值+1作为ObjectID字段输出
SELECT MAX(convert(INT,ObjectID))+1 AS ObjectID FROM I_KHXXGZSJWH