/****** Object: StoredProcedure [dbo].[sp_UpdateOrgAddressFromGAR] ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sp_UpdateOrgAddressFromGAR]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[sp_UpdateOrgAddressFromGAR]
GO
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE dbo.sp_UpdateOrgAddressFromGAR
	@AOGUID uniqueidentifier = null,
	@HouseGUID uniqueidentifier = null,
	@AddressId int
AS
BEGIN
		update orgAddress
		set 
			orgAddress.AOGUID = IsNull(@AOGUID, orgAddress.AOGUID), 
			orgAddress.HouseGUID = IsNull(@HouseGUID, orgAddress.HouseGUID)
		from AKUZ.t_org_address orgAddress
		where orgAddress.OrgAddressID = @AddressId
END
GO