【发布时间】:2017-03-09 21:16:38
【问题描述】:
我是一名 SQL Server DBA,我收到了一个非常奇怪的投诉,即 UPDATE 语句失败。
create table #temp(id int, c nvarchar(10))
alter table #temp add constraint check_empty check (isnull(c,'')<>'')
insert into #temp values(1,N'ABC') --Success
update #temp set c=N'䬠䏊' where id=1 --Fail
update #temp set c=N'䬠䏊.' where id=1 --Success
insert into #temp values(2,N'䬠䏊') --Fail
insert into #temp values(2,N'䬠䏊.') --Success
我有一个带有NVARCHAR 列的表,并且该列上还有一个CHECK 约束。当我通过将. 附加到字符串来更新它时,它会成功。我尝试用谷歌搜索,但没有找到任何相关内容。
提前致谢!
【问题讨论】:
标签: sql-server tsql unicode sql-server-2012