gpt4 book ai didi

sql - SQL中函数参数前面加 'N'的目的是什么?

转载 作者:行者123 更新时间:2023-12-01 22:30:57 25 4
gpt4 key购买 nike

TSQL 中函数参数前面加“N”的目的是什么?

例如下面代码中函数参数前面的N是什么意思:

object_id(N'dbo.MyTable')

最佳答案

它表示“国家化”,又名 unicode 字符串常量。

http://support.microsoft.com/kb/239530

When dealing with Unicode string constants in SQL Server you must precede all Unicode strings with a capital letter N, as documented in the SQL Server Books Online topic "Using Unicode Data".

http://msdn.microsoft.com/en-us/library/aa276823%28SQL.80%29.aspx

nchar and nvarchar

Character data types that are either fixed-length (nchar) or variable-length (nvarchar) Unicode data and use the UNICODE UCS-2 character set.

nchar(n)

Fixed-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size is two times n bytes. The SQL-92 synonyms for nchar are national char and national character.

nvarchar(n)

Variable-length Unicode character data of n characters. n must be a value from 1 through 4,000. Storage size, in bytes, is two times the number of characters entered. The data entered can be 0 characters in length. The SQL-92 synonyms for nvarchar are national char varying and national character varying.

关于sql - SQL中函数参数前面加 'N'的目的是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2448203/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com