Click here to Skip to main content
15,909,953 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SQL
CREATE PROCEDURE  [dbo].[usp_zcCandidateStatus_Select_Submitted_Validating]

AS

BEGIN



 SET NOCOUNT ON;



 DECLARE @ObjectID int

 ,@LanguageID int

 ,@TimezoneID int

 ,@CNLanguageID int;



 SET  @ObjectID = (SELECT TOP 1 ObjectID from zcwTranslatedObjects WHERE ObjectName = 'zcCandidateStatus')



 EXEC usp_getUserPreferences @LanguageID out, @CNLanguageID out, @TimezoneID out;



 SELECT [StatusID]

   ,[Name] = dbo.fnGetTranslatedText(@ObjectID, CONVERT(NVARCHAR(50), StatusID), @LanguageID, @CNLanguageID, [Name])

 FROM zcCandidateStatus

 WHERE [StatusID] = 1 -- for 'Submitted' status

                OR [StatusID] = 8 -- for 'Validating' status

/*

 UNION



 SELECT

 Convert(int,PKID) as StatusID,

 PayRollDesc  = dbo.fnGetTranslatedText(@ObjectID, CONVERT(NVARCHAR(100), PKID), @LanguageID, @CNLanguageID, [Text])

 From zcwMasterTranslation

 where ObjectID=@ObjectID and PKID='-1'

*/

END
Posted
Comments
Nirav Prabtani 7-Aug-13 8:52am    
what is d problame???
santoshroyal 7-Aug-13 9:00am    
explanation for the stored procedure

1 solution

This is declaring some variables for later use
SQL
DECLARE @ObjectID int 
  ,@LanguageID int
  ,@TimezoneID int
  ,@CNLanguageID int;



This sets the @ObjectID variable to the value of the ObjectID column in table zcwTranslatedObjects where the column ObjectName is equal to zcCandidateStatus.
SQL
SET @ObjectID = (SELECT TOP 1 ObjectID from zcwTranslatedObjects WHERE ObjectName = 'zcCandidateStatus')


This calls stored proc usp_getUserPreferences which fills the out parameters with some values, you'd have to look at that procedure to know exactly what.
SQL
EXEC usp_getUserPreferences @LanguageID out, @CNLanguageID out, @TimezoneID out;



This selects out the StatusID and also a translated version of that value by calling fnGetTranslatedText passing in the other parameters. And it does that for candidates in status Submitted or Validating only.
You need to look at function fnGetTranslatedText to see exactly what it does.
SQL
SELECT [StatusID], [Name] = dbo.fnGetTranslatedText(@ObjectID, CONVERT(NVARCHAR(50), StatusID), @LanguageID, @CNLanguageID, [Name])
FROM zcCandidateStatus
WHERE 
   [StatusID] = 1 -- for 'Submitted' status
OR [StatusID] = 8 -- for 'Validating' status


Hope this helps,
Fredrik
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900