标签:os ar for on c ad sql har as
DECLARE @ProName NVARCHAR(50)
DECLARE @CityName NVARCHAR(50)
DECLARE @ProId INT
DECLARE @CityId INT
DECLARE Test_Cursor CURSOR FOR
SELECT a.AreaId,a.AreaName,b.AreaName FROM AreaFull AS a RIGHT JOIN AreaFull AS b ON a.AreaPid=b.AreaId WHERE a.AreaPid>34
OPEN Test_Cursor
FETCH NEXT FROM Test_Cursor INTO @CityId,@CityName,@ProName
WHILE @@FETCH_STATUS = 0
BEGIN
SET @ProId=(SELECT ID FROM dbo.Web_Area WHERE Name=@ProName AND OrderId=27 )
INSERT INTO Web_Area(Name,HeadID,LV,Family,OrderId) VALUES(@CityName,@ProId,4,4,28)
FETCH NEXT FROM Test_Cursor INTO @CityId,@CityName,@ProName
END
CLOSE Test_cursor
DEALLOCATE Test_cursor
SELECT * FROM dbo.Web_Area
标签:os ar for on c ad sql har as
原文地址:http://www.cnblogs.com/baiyunchen/p/3952931.html