TERTIARY_WEIGHTS (Transact-SQL)
Collapse the table of content
Expand the table of content

TERTIARY_WEIGHTS (Transact-SQL)

 

THIS TOPIC APPLIES TO: yesSQL Server (starting with 2008)yesAzure SQL DatabaseyesAzure SQL Data Warehouse yesParallel Data Warehouse

Returns a binary string of weights for each character in a non-Unicode string expression defined with an SQL tertiary collation.

Topic link icon Transact-SQL Syntax Conventions

  
TERTIARY_WEIGHTS( non_Unicode_character_string_expression )  

-- Azure SQL Data Warehouse and Parallel Data Warehouse  
TERTIARY_WEIGHTS(non_Unicode_character_string_expression )  

non_Unicode_character_string_expression
Is a string expression of type char, varchar, or varchar(max) defined on a tertiary SQL collation. For a list of these collations, see Remarks.

TERTIARY_WEIGHTS returns varbinary when non_Unicode_character_string_expression is char or varchar, and returns varbinary(max) when non_Unicode_character_string_expression is varchar(max).

TERTIARY_WEIGHTS returns NULL when non_Unicode_character_string_expression is not defined with an SQL tertiary collation. The following table shows the SQL tertiary collations.

Sort order IDSQL collation
33SQL_Latin1_General_Pref_CP437_CI_AS
34SQL_Latin1_General_CP437_CI_AI
43SQL_Latin1_General_Pref_CP850_CI_AS
44SQL_Latin1_General_CP850_CI_AI
49SQL_1xCompat_CP850_CI_AS
53SQL_Latin1_General_Pref_CP1_CI_AS
54SQL_Latin1_General_CP1_CI_AI
56SQL_AltDiction_Pref_CP850_CI_AS
57SQL_AltDiction_CP850_CI_AI
58SQL_Scandinavian_Pref_CP850_CI_AS
82SQL_Latin1_General_CP1250_CI_AS
84SQL_Czech_CP1250_CI_AS
86SQL_Hungarian_CP1250_CI_AS
88SQL_Polish_CP1250_CI_AS
90SQL_Romanian_CP1250_CI_AS
92SQL_Croatian_CP1250_CI_AS
94SQL_Slovak_CP1250_CI_AS
96SQL_Slovenian_CP1250_CI_AS
106SQL_Latin1_General_CP1251_CI_AS
108SQL_Ukrainian_CP1251_CI_AS
113SQL_Latin1_General_CP1253_CS_AS
114SQL_Latin1_General_CP1253_CI_AS
130SQL_Latin1_General_CP1254_CI_AS
146SQL_Latin1_General_CP1256_CI_AS
154SQL_Latin1_General_CP1257_CI_AS
156SQL_Estonian_CP1257_CI_AS
158SQL_Latvian_CP1257_CI_AS
160SQL_Lithuanian_CP1257_CI_AS
183SQL_Danish_Pref_CP1_CI_AS
184SQL_SwedishPhone_Pref_CP1_CI_AS
185SQL_SwedishStd_Pref_CP1_CI_AS
186SQL_Icelandic_Pref_CP1_CI_AS

TERTIARY_WEIGHTS is intended for use in the definition of a computed column that is defined on the values of a char, varchar, or varchar(max) column. Defining an index on both the computed column and the char, varchar, or varchar(max) column can improve performance when the char, varchar, or varchar(max) column is specified in the ORDER BY clause of a query.

The following example creates a computed column in a table that applies the TERTIARY_WEIGHTS function to the values of a char column.

CREATE TABLE TertColTable  
(Col1 char(15) COLLATE SQL_Latin1_General_Pref_CP437_CI_AS,  
Col2 AS TERTIARY_WEIGHTS(Col1));  
GO   

ORDER BY Clause (Transact-SQL)

Community Additions

ADD
Show:
© 2016 Microsoft