DEclare @RoleID INT
DEclare @WebPageID INT
DECLARE CaseStudy_Role CURSOR FOR SELECT RoleID FROM Role WHERE RoleID in (1,2,3,4,5)
OPEN CaseStudy_Role
FETCH NEXT FROM CaseStudy_Role INTO @RoleID
WHILE @@Fetch_status = 0
BEGIN
DECLARE CaseStudy_WebPage CURSOR FOR SELECT WebPageID FROM WebPage
OPEN CaseStudy_WebPage
FETCH NEXT FROM CaseStudy_WebPage INTO @WebPageID
WHILE @@Fetch_status = 0
BEGIN
INSERT INTO RoleRight VALUES(@WebPageID, @RoleID)
FETCH NEXT FROM CaseStudy_WebPage INTO @WebPageID
END
CLOSE CaseStudy_WebPage
DEallocate CaseStudy_WebPage
FETCH NEXT FROM CaseStudy_Role INTO @RoleID
END
CLOSE CaseStudy_Role
DEallocate CaseStudy_Role
No comments:
Post a Comment