title: Upload .sql file to remote server
body: <p>‌Our development team is working on different .net applications. 
  ‌They create new tables stored procedures and other objects and when they are done they need to upload changes in database which is remotely located. </p>
  
  <p>M‌y Task is to create an application which compares both database objects (local and remote) and make changes in remote database. </p>
  
  <p>‌so what i did was i created .net app which scripts all objects create .sql file with all changes 
  ‌
  the .net application which connects to remote server over the internet and run .sql file which i generated.</p>
  
  <p>‌Every time the script checks whole database drop all objects which dont have data like stored procedure , views , types etc and recreate them 
  ‌
  It goes well the .sql file handles every thing very well but the problem is that its too slow </p>
  
  <p>a‌ .sql file with 48k line of code takes about 25 minutes to run remotely 
  ‌
  n‌ow i need solution to increase the speed . what i thought was to upload .sql file which is of 1mb and then run it on server side but i cant do it manually as it will ruin the whole concept i want my app to upload the file and run it 
  Please suggest and if you have any better approach please do let me know that too 
  Thanks
  Sample Sql Code is Given Below</p>
  
  <pre><code>  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
  </code></pre>