我是否在“插入到"中使用了前缀 N?Unicode 的声明? [英] Do I have use the prefix N in the "insert into" statement for unicode?

查看:21
本文介绍了我是否在“插入到"中使用了前缀 N?Unicode 的声明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜欢:
插入表 (col) 值(N'多语言 unicode 字符串')

Like:
insert into table (col) values (N'multilingual unicode strings')

我使用的是 SQL Server 2008,并且我已经使用 nVarChar 作为列数据类型.

I'm using SQL Server 2008 and I already use nVarChar as the column data type.

推荐答案

仅当字符串包含不在默认代码页内的字符时,您才需要 N'' 语法.最佳实践"是在插入 nvarchar 或 ntext 列时使用 N''.

You need the N'' syntax only if the string contains characters which are not inside the default code page. "Best practice" is to have N'' whenever you insert into an nvarchar or ntext column.

这篇关于我是否在“插入到"中使用了前缀 N?Unicode 的声明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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