title: use stored procedure to select last item value
body: <p>i am trying to select the last record value from my database by using stored procedure, to do this i set my <code>@UPID</code> parameter as <code>SCORE_IDENTITY()</code>, but there are no output result as all after i execute my stored procedure</p>
  
  <pre><code>CREATE PROCEDURE [dbo].[spAuditLogSelect_NewUser]
  
  @UPID   int
  AS
  BEGIN
  
  SET @UPID = SCOPE_IDENTITY()
  
  
  SELECT
  siUserProfile.UPID
  ,siUserProfile.ProfileType, siProfileType.RGDName AS ProfileTypeName
  ,siUserProfile.CBID, siCompany.ComName + ' - ' + siComBranch.ComBranchName AS CBName
  ,siUserProfile.FullName
  ,siUserProfile.ShortName
  ,siUserProfile.SerialCode
  ,siUserProfile.Serial
  ,siUserProfile.Gender
  
  
  
  from siUserProfile WITH (NOLOCK)
  inner join siUserProfileDetail WITH (NOLOCK) on siUserProfile.upid =             siUserProfileDetail.UPID 
  left outer join siReferenceGroupDetail siProfileType WITH (NOLOCK) ON siUserProfile.ProfileType = siProfileType.RGDID
  left outer join siComBranch WITH (NOLOCK) on siComBranch.CBID = siUserProfile.CBID
  left outer join siCompany WITH (NOLOCK) ON siComBranch.CompanyID = siCompany.CompanyID
  
  
  where siUserProfile.UPID = @UPID
  </code></pre>