ALTER TABLE [dbo].[ApiCourierPackages]
  ADD SenderAdressCountry [nvarchar](60) NULL,
   AdressCountry [nvarchar](60) NULL
  GO
  update [dbo].ApiDepartaments set SenderAdressCountry = 'PL', AdressCountry='PL' where ISNULL(SenderAdressCountry,'xxx')='xxx';
  GO


ALTER TABLE [dbo].ApiDepartaments
  ADD AdrrCountryCode [nvarchar](60) NULL;
  GO
  update [dbo].ApiDepartaments set AdrrCountryCode = 'PL' where ISNULL(AdrrCountryCode,'xxx')='xxx';
  GO

  ALTER TABLE [dbo].ApiCustomers
  ADD AdrrCountryCode [nvarchar](60) NULL;
  GO
  update [dbo].ApiCustomers set AdrrCountryCode = 'PL' where ISNULL(AdrrCountryCode,'xxx')='xxx';
  GO

    ALTER TABLE [dbo].ApiWmsDocuments
  ADD PackageInfo [nvarchar](max) NULL;
  GO
  update [dbo].ApiWmsDocuments set PackageInfo = '' where ISNULL(PackageInfo,'xxx')='xxx';
  GO

      ALTER TABLE [dbo].ApiCouriers
  ADD IsDefault int NULL;
  GO
  update [dbo].ApiCouriers set IsDefault = 0 where ISNULL(IsDefault,-1)=-1;
  GO

        ALTER TABLE [dbo].ApiSerialNumbers
  ADD ObjectType int NULL;
  GO
  update [dbo].ApiSerialNumbers set ObjectType = 0 where ISNULL(ObjectType,-1)=-1;
  GO


  
        ALTER TABLE [dbo].ApiSerialNumbers
  ADD ObjectType int NULL;
  GO
  update [dbo].ApiSerialNumbers set ObjectType = 0 where ISNULL(ObjectType,-1)=-1;
  GO
  

    ALTER TABLE [dbo].ApiWmsDocuments
  ADD PackageInfo nvarchar(100)
  GO
update [dbo].ApiWmsDocuments set PackageInfo = '' where ISNULL(PackageInfo,'xxx')='xxx'
  GO


      ALTER TABLE [dbo].ApiDocuments
  ADD PriceId int 
  GO
update [dbo].ApiDocuments set PriceId = 
ISNULL((  select top 1 PriceId from dbo.ApiCustomerView c where c.Id = [dbo].ApiDocuments.CustId),0)
where ISNULL(PriceId,-1)=-1
  GO


  