随笔分类 -  SqlServer

摘要:1、查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断<!--more--> select * from people where peopleId in (select peopleId from people group by peopleId having count(p 阅读全文
posted @ 2016-04-13 09:30 时光吹老了好少年 阅读(1394) 评论(0) 推荐(0)
摘要:DECLARE My_Cursor CURSOR --定义游标 declare@indexId int FOR (SELECT * FROM dbo.GalleryPhoto) --查出需要的集合放到游标中 OPEN My_Cursor; --打开游标 FETCH NEXT FROM My_Curs 阅读全文
posted @ 2016-04-12 09:15 时光吹老了好少年 阅读(592) 评论(0) 推荐(0)
摘要:ALTER Trigger [dbo].[test] --新建触发器 On [dbo].[test1] --在test1表中创建触发器 for insert --触发条件 As --事件触发后所要做的事情 declare @id int, @test varchar(20); --定义变量 sele 阅读全文
posted @ 2016-04-12 09:15 时光吹老了好少年 阅读(524) 评论(0) 推荐(0)