我有一个旧数据库,我试图转换为新的数据库结构但在继续之前我想知道是否有任何最佳方法可以做。 我尝试过使用Cursor但需要时间。我有13个表从旧数据库迁移到新数据库。
DECLARE @GGroupId as Int;
DECLARE @GName as NVARCHAR(MAX);
DECLARE @GDescription as NVARCHAR(MAX);
DECLARE @GLastModification as DateTime;
DECLARE @GLastUser as NVARCHAR(MAX);
DECLARE @Prio as int;
DECLARE @NEW_GROUP_ID as int;
DECLARE @PProupId as Int;
DECLARE @PName as NVARCHAR(MAX);
DECLARE @PDescription as NVARCHAR(MAX);
DECLARE @PLastModification as DateTime;
DECLARE @PLastUser as NVARCHAR(MAX);
DECLARE Group_Cursor CURSOR FOR
SELECT Ord_Id, Bezeich,Notiz, Prio
FROM [MigrationAPlanDB].[dbo].[Ordner];
OPEN Group_Cursor
FETCH NEXT FROM Group_Cursor INTO @GGroupId, @GName, @GDescription, @Prio;
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @USERID as int;
/*SELECT U.Id from [MigrationAPlanDB].[dbo].User_Names as U where U.User = @GLastUser INTO @USERID;*/
INSERT INTO [ProjectManagement].[dbo].[Groups] (Name, Description, Priority ,CreatorId, InsertDate, IsDeleted)
VALUES (@GName, cast(@GDescription as ntext), @Prio, 1, GETDATE(), 0)
SET @NEW_GROUP_ID = SCOPE_IDENTITY()
DECLARE Project_Cursor CURSOR FOR
SELECT Pro_ID,Bezeich, Notiz, LastModification, LastUser FROM [MigrationAPlanDB].[dbo].[Projekte] WHERE Ord_Id = @GGroupId;
OPEN Project_Cursor;
FETCH NEXT FROM Project_Cursor INTO @PProupId, @PName, @PDescription, @PLastModification, @PLastUser;
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO [ProjectManagement].[dbo].[Projects] (Name, Description,UpdateDate
,CreatorId, InsertDate) VALUES (@PName, @PDescription, @PLastModification, 1, GETDATE());
/*SELECT SCOPE_IDENTITY() INTO @NEW_PROJECT_ID;*/
END;
CLOSE Project_Cursor
DEALLOCATE Project_Cursor
END;
CLOSE Group_Cursor
DEALLOCATE Group_Cursor
GO
答案 0 :(得分:0)
你为什么使用游标?你尝试过这样的事情:
let nib = UINib(nibName: "your nib file name",bundle: nil)
erxTable.registerNib(nib, forCellReuseIdentifier: "identifiername")