我们的开发团队正在开发不同的.net应用程序。 他们创建新的表存储过程和其他对象,完成后,他们需要上传远程数据库中的更改。
我的任务是创建一个应用程序,它比较两个数据库对象(本地和远程)并在远程数据库中进行更改。
所以我所做的是我创建的.net app脚本所有对象创建.sql文件包含所有更改 .net应用程序通过Internet连接到远程服务器并运行我生成的.sql文件。
每次脚本检查整个数据库时,都会删除所有没有存储过程,视图,类型等数据的对象并重新创建它们 很好的.sql文件很好地处理每一件事,但问题是它太慢了
具有48k代码行的.sql文件大约需要25分钟才能远程运行 现在我需要解决方案来提高速度。我认为上传的.sql文件是1mb,然后在服务器端运行它,但我不能手动操作,因为它会破坏整个概念,我希望我的应用程序上传文件并运行它 请提出建议,如果您有更好的方法,请告诉我 谢谢 示例Sql代码在下面给出
IF object_id('TBU_BankWithdrawalVoucher', 'U') is null
Create Table [dbo].[TBU_BankWithdrawalVoucher](
[PKGUID] uniqueidentifier Not Null ,
[AutoID] int Identity (1, 1) Not Null ,
[VNo] nvarchar (255) Not Null ,
[VDate] datetime Not Null ,
[RecNo] nvarchar (255) Not Null ,
[RefNo] nvarchar (255) Not Null ,
[AccountDID] uniqueidentifier Not Null ,
[CashRegisterDID] uniqueidentifier Not Null ,
[Remarks] nvarchar (255) Not Null ,
[Amount] money Not Null ,
[CB] uniqueidentifier Not Null ,
[CDate] datetime Not Null ,
[MB] uniqueidentifier Not Null ,
[MDate] datetime Not Null ,
[DB] uniqueidentifier Not Null ,
[DDate] datetime Not Null ,
[BranchID] smallint Not Null ,
[RowVer] RowVersion Not Null ,
[ISD] uniqueidentifier Not Null ,
[AppType] smallint Not Null )
Go
IF OBJECT_ID('DF_TBU_BankWithdrawalVoucher_PKGUID', 'D') IS Not NULL
Begin
ALTER TABLE [dbo].[TBU_BankWithdrawalVoucher] Drop CONSTRAINT [DF_TBU_BankWithdrawalVoucher_PKGUID]
End
Go
IF OBJECT_ID('DF_TBU_BankWithdrawalVoucher_VNo', 'D') IS Not NULL
Begin
ALTER TABLE [dbo].[TBU_BankWithdrawalVoucher] Drop CONSTRAINT [DF_TBU_BankWithdrawalVoucher_VNo]
End
Go
IF OBJECT_ID('DF_TBU_BankWithdrawalVoucher_VDate', 'D') IS Not NULL
Begin
ALTER TABLE [dbo].[TBU_BankWithdrawalVoucher] Drop CONSTRAINT [DF_TBU_BankWithdrawalVoucher_VDate]
End
Go
IF OBJECT_ID('DF_TBU_BankWithdrawalVoucher_RecNo', 'D') IS Not NULL
Begin
ALTER TABLE [dbo].[TBU_BankWithdrawalVoucher] Drop CONSTRAINT [DF_TBU_BankWithdrawalVoucher_RecNo]
End
Go
IF OBJECT_ID('DF_TBU_BankWithdrawalVoucher_RefNo', 'D') IS Not NULL
Begin
ALTER TABLE [dbo].[TBU_BankWithdrawalVoucher] Drop CONSTRAINT [DF_TBU_BankWithdrawalVoucher_RefNo]
End
Go
IF OBJECT_ID('DF_TBU_BankWithdrawalVoucher_AccountDID', 'D') IS Not NULL
Begin
ALTER TABLE [dbo].[TBU_BankWithdrawalVoucher] Drop CONSTRAINT [DF_TBU_BankWithdrawalVoucher_AccountDID]
End
Go
IF OBJECT_ID('DF_TBU_BankWithdrawalVoucher_CashRegisterDID', 'D') IS Not NULL
Begin
ALTER TABLE [dbo].[TBU_BankWithdrawalVoucher] Drop CONSTRAINT [DF_TBU_BankWithdrawalVoucher_CashRegisterDID]
End
Go