ALTER PROCEDURE [dbo].[InsertAlbum_sp] ( @Member_Id varchar(10), @albumTitle varchar(50) ) AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; declare @newId varchar(10) declare @length int if(select MAX(album_Id) from album_tb)<>'null' begin set @length=(select len(max(album_Id)) from album_tb) set @newId=(select SUBSTRING(max(album_Id),1,@length)+1 from album_tb) set @newId='A'+RIGHT(cast(@newId as varchar(10)),1) end else begin set @newId='A1' end insert into album_tb (album_Id,Member_Id,albumTitle) values (@newId,@Member_Id,@albumTitle) select @newId END
varchar
'A1'
int
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)