I'm working on a project where I've made a Store procedure to load Bulk of customers data in CustomersInfo table.
There is customer's City Id in a table.
So i want when there is new city of customer then new city will added to City table.
I'm not getting the logic to do that.
Can anyone please help me?
Here's my Store Procedure
alter procedure sp_AddCustomerBulk
@CompanyId int,
@jsonstring nvarchar(max)
as begin
select * from OPENJSON(@jsonstring)
WITH (MemberId int,CompanyId int,ShopId int, MemberName nvarchar(500), CityName nvarchar(50), CityAreaName nvarchar(50), Email nvarchar(50), PhoneResident nvarchar(25), PhoneOffice nvarchar(25), PhoneMobile nvarchar(25), Comments nvarchar(500) , MemberDOB datetime , MemberAnniversary datetime , CNIC nvarchar(20) , Gender nvarchar(10), CreditLimit numeric(18,4) , AllowCredit bit , MemberAddress nvarchar(500) , MemberTypeName nvarchar(50) , OpeningBalance money)
end