This is declaring some variables for later use
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.
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.
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.
SELECT [StatusID], [Name] = dbo.fnGetTranslatedText(@ObjectID, CONVERT(NVARCHAR(50), StatusID), @LanguageID, @CNLanguageID, [Name])
FROM zcCandidateStatus
WHERE
[StatusID] = 1
OR [StatusID] = 8
Hope this helps,
Fredrik