USE [LABORATORY] GO /****** Object: StoredProcedure [dbo].[Lab_Barcode_Update] Script Date: 09/02/2019 7:13:34 PM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[Lab_Barcode_Update] @Barcode as varchar(15), @RefNum as varchar(50), @SpecimenID as varchar(4) = null, @SectionID as varchar(4) = null AS declare @CharLength as int set @CharLength = (select datalength(@Barcode)) update LABORATORY..tbLabMaster set Barcode = @Barcode where RefNum = @RefNum and SpecimenID = @SpecimenID and SectionID = @SectionID and Barcode is NULL