Begin
declare @id int,@Text nvarchar(50)
declare @index int,@oldid int
/*創建一個臨時表來存儲最終結果*/
/*
參數說明:
Code:標識代號
sName:名稱
number:層次
/*
declare @returnTable Table(Code int,sName nvarchar(50),number int)
/*創建一個游標來分別講習取命名空間數據*/
Declare nameSpaceCursor Cursor local forward_only static read_only type_warning
for select id,name from tbl_NameSpace
open nameSpaceCursor
fetch next from nameSpaceCursor into @id,@Text
while @@fetch_status=0
Begin
set @index=1 --為1表命名空間
Insert into @returnTable values(@id,@Text,@index)
/*創建一個游標來分別讀取類名*/
Declare classCursor Cursor local forward_only static read_only type_warning
for select id,name from tbl_Class where namespaceid=@id
open classCursor
fetch next from classCursor into @id,@Text
while @@fetch_status=0
Begin
set @index=2 --為2表類
Insert into @returnTable values(@id,@Text,@index)
set @oldid=0
set @oldid=@id
/*創建一個游標來分別讀取屬性名*/
Declare attributeCursor Cursor local forward_only static read_only type_warning
for select id,name from tbl_Attribute where classId=@id
open attributeCursor
fetch next from attributeCursor into @id,@Text
while @@fetch_status=0
Begin
set @index=3 --為3表屬性
Insert into @returnTable values(@id,@Text,@index)
fetch next from attributeCursor into @id,@Text
End
close attributeCursor
deallocate attributeCursor
/*創建一個游標來分別讀取方法名*/
Declare mothodCursor cursor local forward_only static read_only type_warning
for select id,name from tbl_method where classid=@oldid
open mothodCursor
fetch next from mothodCursor into @id,@Text
while @@fetch_status=0
Begin
set @index=4 --為4表方法
Insert into @returnTable values(@id,@Text,@index)
fetch next from mothodCursor into @id,@Text
End
close mothodCursor
deallocate mothodCursor
/*創建一個游標來分別讀取類成員*/
--..
/*創建一個游標來分別讀取事件*/
--.
/*同樣創建其它的*/
fetch next from classCursor into @id,@Text
End
close classCursor
deallocate classCursor
fetch next from nameSpaceCursor into @id,@Text
End
close nameSpaceCursor
deallocate nameSpaceCursor
Select * from @returnTable
End
declare @id int,@Text nvarchar(50)
declare @index int,@oldid int
/*創建一個臨時表來存儲最終結果*/
/*
參數說明:
Code:標識代號
sName:名稱
number:層次
/*
declare @returnTable Table(Code int,sName nvarchar(50),number int)
/*創建一個游標來分別講習取命名空間數據*/
Declare nameSpaceCursor Cursor local forward_only static read_only type_warning
for select id,name from tbl_NameSpace
open nameSpaceCursor
fetch next from nameSpaceCursor into @id,@Text
while @@fetch_status=0
Begin
set @index=1 --為1表命名空間
Insert into @returnTable values(@id,@Text,@index)
/*創建一個游標來分別讀取類名*/
Declare classCursor Cursor local forward_only static read_only type_warning
for select id,name from tbl_Class where namespaceid=@id
open classCursor
fetch next from classCursor into @id,@Text
while @@fetch_status=0
Begin
set @index=2 --為2表類
Insert into @returnTable values(@id,@Text,@index)
set @oldid=0
set @oldid=@id
/*創建一個游標來分別讀取屬性名*/
Declare attributeCursor Cursor local forward_only static read_only type_warning
for select id,name from tbl_Attribute where classId=@id
open attributeCursor
fetch next from attributeCursor into @id,@Text
while @@fetch_status=0
Begin
set @index=3 --為3表屬性
Insert into @returnTable values(@id,@Text,@index)
fetch next from attributeCursor into @id,@Text
End
close attributeCursor
deallocate attributeCursor
/*創建一個游標來分別讀取方法名*/
Declare mothodCursor cursor local forward_only static read_only type_warning
for select id,name from tbl_method where classid=@oldid
open mothodCursor
fetch next from mothodCursor into @id,@Text
while @@fetch_status=0
Begin
set @index=4 --為4表方法
Insert into @returnTable values(@id,@Text,@index)
fetch next from mothodCursor into @id,@Text
End
close mothodCursor
deallocate mothodCursor
/*創建一個游標來分別讀取類成員*/
--..
/*創建一個游標來分別讀取事件*/
--.
/*同樣創建其它的*/
fetch next from classCursor into @id,@Text
End
close classCursor
deallocate classCursor
fetch next from nameSpaceCursor into @id,@Text
End
close nameSpaceCursor
deallocate nameSpaceCursor
Select * from @returnTable
End