USE [RealEstate] GO /****** Object: StoredProcedure [dbo].[SP_AutoNumber] Script Date: 17/04/2014 12:00:31 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[SP_AutoNumber] @code int, @MaxValue int, @LastValue int , @strGUID uniqueidentifier AS (select @MaxValue = max(RealEstateNumber) from RlRegistrationRealEstate) if @MaxValue is null set @MaxValue = '0001' set @LastValue = right(@MaxValue,3) + 1 return right('000' + convert(varchar(4),@lastValue),4) set @MaxValue= @MaxValue + @LastValue UPDATE [dbo].RlRegistrationRealEstate SET RealEstateNumber=@MaxValue WHERE GUID = @strGUID
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)