- USE [Billing-AJA]
- GO
- /****** Object: StoredProcedure [dbo].[spExtensionInsert] Script Date: 7/14/2025 8:52:36 AM ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- ALTER proc [dbo].[spExtensionInsert]
- @Extid nvarchar(250),
- @Firstname nvarchar(250),
- @Lastname nvarchar(250),
- @Building nvarchar(50),
- @Floor nvarchar(50),
- @Room nvarchar(50),
- @Address nvarchar(50),
- @Description nvarchar(50),
- @RingGroup nvarchar(50)
- as
- BEGIN
- if exists (select 1 FROM [dbo].extension WHERE [Extension] = @Extid)
- BEGIN
- update [dbo].extension
- SET
- Firstname = @Firstname,
- Lastname = @Lastname,
- [RingGroup] = case when @RingGroup = '1' then 'true' else 'false' end
- where [Extension] = @Extid;
- update [dbo].[extension-locations]
- set
- [Building] = @Building,
- [Floor] = @Floor,
- [Room] = @Room,
- [Address] = @Address,
- [Description] = @Description
- where [ExtensionId] = @Extid;
- END
- ELSE
- BEGIN
- INSERT into [dbo].extension values(@Extid,@Firstname,@Lastname,case when @RingGroup = '1' then 'true' else 'false' end)
- INSERT into [dbo].[extension-locations] values(@Extid,@Building,@Floor,@room,@Address,@Description)
- end
- END
Recent Pastes