declare @User_CodeV nvarchar(500) , @User_Pwd nvarchar(500) , @User_Name nvarchar(500) , @RndId nvarchar(500) ,@identity numeric(18,0) select @RndId =cast(ceiling(rand(checksum(newid()))*10000) as int) select @User_CodeV='BI_her2' , @User_Pwd=left( @User_CodeV, charindex('_',@User_CodeV)-1) +@RndId ,@User_Name=''