dbo.uspSearchCandidateResumes Stored Procedure
In This Topic
Properties
Creation Date | 27/10/2017 14:33 |
Encrypted |  |
Ansi Nulls |  |
Parameters
Parameter | Direction | Description | Data Type | Size |
@searchString | In | | VarWChar | 1000 |
@useInflectional | In | | Boolean | 1 |
@useThesaurus | In | | Boolean | 1 |
@language | In | | Integer | 4 |
@RETURN_VALUE | Return Value | | Integer | 4 |
Objects that dbo.uspSearchCandidateResumes depends on
| Database Object | Object Type | Description | Dep Level |
 | Person.BusinessEntity | Table | Source of the ID that connects vendors, customers, and employees with address and contact information. | 2 |
 | HumanResources.Employee | Table | Employee information such as salary, department, and title. | 3 |
 | dbo.Flag | User Defined Data Type | | 4 |
 | HumanResources.JobCandidate | Table | Résumés submitted to Human Resources by job applicants. | 2 |
 | dbo.Name | User Defined Data Type | | 2 |
 | dbo.NameStyle | User Defined Data Type | | 5 |
 | Person.Person | Table | Human beings involved with AdventureWorks: employees, customer contacts, and vendor contacts. | 4 |
Procedure Source Code
--A stored procedure which demonstrates integrated full text search
CREATE PROCEDURE [dbo].[uspSearchCandidateResumes]
@searchString [nvarchar](1000),
@useInflectional [bit]=0,
@useThesaurus [bit]=0,
@language[int]=0
WITH EXECUTE AS CALLER
AS
BEGIN
SET NOCOUNT ON;
DECLARE @string nvarchar(1050)
--setting the lcid to the default instance LCID if needed
IF @language = NULL OR @language = 0
BEGIN
SELECT @language =CONVERT(int, serverproperty('lcid'))
END
--FREETEXTTABLE case as inflectional and Thesaurus were required
IF @useThesaurus = 1 AND @useInflectional = 1
BEGIN
SELECT FT_TBL.[JobCandidateID], KEY_TBL.[RANK] FROM [HumanResources].[JobCandidate] AS FT_TBL
INNER JOIN FREETEXTTABLE([HumanResources].[JobCandidate],*, @searchString,LANGUAGE @language) AS KEY_TBL
ON FT_TBL.[JobCandidateID] =KEY_TBL.[KEY]
END
ELSE IF @useThesaurus = 1
BEGIN
SELECT @string ='FORMSOF(THESAURUS,"'+@searchString +'"'+')'
SELECT FT_TBL.[JobCandidateID], KEY_TBL.[RANK] FROM [HumanResources].[JobCandidate] AS FT_TBL
INNER JOIN CONTAINSTABLE([HumanResources].[JobCandidate],*, @string,LANGUAGE @language) AS KEY_TBL
ON FT_TBL.[JobCandidateID] =KEY_TBL.[KEY]
END
ELSE IF @useInflectional = 1
BEGIN
SELECT @string ='FORMSOF(INFLECTIONAL,"'+@searchString +'"'+')'
SELECT FT_TBL.[JobCandidateID], KEY_TBL.[RANK] FROM [HumanResources].[JobCandidate] AS FT_TBL
INNER JOIN CONTAINSTABLE([HumanResources].[JobCandidate],*, @string,LANGUAGE @language) AS KEY_TBL
ON FT_TBL.[JobCandidateID] =KEY_TBL.[KEY]
END
ELSE --base case, plain CONTAINSTABLE
BEGIN
SELECT @string='"'+@searchString +'"'
SELECT FT_TBL.[JobCandidateID],KEY_TBL.[RANK] FROM [HumanResources].[JobCandidate] AS FT_TBL
INNER JOIN CONTAINSTABLE([HumanResources].[JobCandidate],*,@string,LANGUAGE @language) AS KEY_TBL
ON FT_TBL.[JobCandidateID] =KEY_TBL.[KEY]
END
END;
|
See Also