在T-SQL中强制转换nvarchar变量的排序规则 [英] Cast collation of nvarchar variables in t-sql

查看:114
本文介绍了在T-SQL中强制转换nvarchar变量的排序规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要更改nvarchar变量的排序规则。 通过文档

I need to change the collation of an nvarchar variable. By documentation:


(...)
3.可以在多个级别将COLLATE子句指定为
。这些包括以下

(...) 3. The COLLATE clause can be specified at several levels. These include the following:

投射
表达式的排序规则。您可以使用COLLATE
子句将字符表达式
应用于特定的排序规则。字符
的文字和变量被赋予
当前
数据库的默认排序规则。列引用是
分配给列
的定义排序规则。有关
表达式的排序规则,请参见排序规则
(Transact-SQL)。

Casting the collation of an expression. You can use the COLLATE clause to apply a character expression to a certain collation. Character literals and variables are assigned the default collation of the current database. Column references are assigned the definition collation of the column. For the collation of an expression, see Collation Precedence (Transact-SQL).

但是我无法找出正确的语法来使用为此,可以使用CAST(),CONVERT()或带有DECLARE的变量声明。

However I can't figure out the correct syntax for the usage of CAST(), CONVERT() or variable declaration with DECLARE for this purpose.

推荐答案

SELECT CAST('abc' AS varchar(5)) COLLATE French_CS_AS

这篇关于在T-SQL中强制转换nvarchar变量的排序规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆