34,576
社区成员
发帖
与我相关
我的任务
分享
create table Instrument(id int,InBrand ntext,InClass nvarchar(1000))
go
insert into Instrument values(1,N'徕卡','TS02')
select InBrand+InClass
from Instrument
/*
Msg 402, Level 16, State 1, Line 1
The data types ntext and nvarchar are incompatible in the add operator.
*/
select convert(nvarchar(max),InBrand)+InClass
from Instrument
/*
AAAAAAAAAAAAAAAAAAAAAAMMMMMMMMMMMMMMMMM
*/
drop table Instrument
然后就提示
消息 402,级别 16,状态 1,第 3 行
数据类型 ntext 和 nvarchar 在 add 运算符中不兼容。
[/quote]create table T(id int,aaa ntext,bbb nvarchar(1000))
go
insert into T values(1,N'AAAAAAAAAAAAAAAAAAAAAA','MMMMMMMMMMMMMMMMM')
select aaa+bbb
from T
/*
Msg 402, Level 16, State 1, Line 1
The data types ntext and nvarchar are incompatible in the add operator.
*/
select convert(nvarchar(max),aaa)+bbb
from T
/*
AAAAAAAAAAAAAAAAAAAAAAMMMMMMMMMMMMMMMMM
*/
drop table T
create table Instrument(id int,InBrand ntext,InClass nvarchar(1000))
go
insert into Instrument values(1,N'徕卡','TS02')
select InBrand+InClass
from Instrument
/*
Msg 402, Level 16, State 1, Line 1
The data types ntext and nvarchar are incompatible in the add operator.
*/
select convert(nvarchar(max),InBrand)+InClass
from Instrument
/*
AAAAAAAAAAAAAAAAAAAAAAMMMMMMMMMMMMMMMMM
*/
drop table Instrument
然后就提示
消息 402,级别 16,状态 1,第 3 行
数据类型 ntext 和 nvarchar 在 add 运算符中不兼容。
select inbrand+inclass+'-'+inaccuracy+'"'+intype+'"' from Instrucments