请教一棘手问题,sql_ variant 转换 nvarchar 的问题 100
@htmlfield=casewhenC.is_identity<>1then@htmlfield+'<divclass="row"><divclass="spanw01...
@htmlfield=
case
when C.is_identity <> 1 then @htmlfield+'<div class="row">
<div class="span w0100 inner-right">'+(select EP.value from sys.extended_properties EP where major_id =C.object_id and minor_id = C.column_id)+'</div>
<div class="span w0001"> </div>
<div class="span w0300"><input type="text" class="text" name="'+C.name+'" /></div>
<div class="clear"></div>
</div>' +char(10)
else @htmlfield+''
end
在第四行报错:
The data types nvarchar(max) and sql_variant are incompatible in the add operator.
翻译过来是:在数据连接操作时数据类型nvarchar(max)和sql_variant不兼容
关键问题是:怎么让他兼容,转换过去。
注意:问题是在Case End这样的语法里面就会报这样的错误,在Select 里面就没有错误 展开
case
when C.is_identity <> 1 then @htmlfield+'<div class="row">
<div class="span w0100 inner-right">'+(select EP.value from sys.extended_properties EP where major_id =C.object_id and minor_id = C.column_id)+'</div>
<div class="span w0001"> </div>
<div class="span w0300"><input type="text" class="text" name="'+C.name+'" /></div>
<div class="clear"></div>
</div>' +char(10)
else @htmlfield+''
end
在第四行报错:
The data types nvarchar(max) and sql_variant are incompatible in the add operator.
翻译过来是:在数据连接操作时数据类型nvarchar(max)和sql_variant不兼容
关键问题是:怎么让他兼容,转换过去。
注意:问题是在Case End这样的语法里面就会报这样的错误,在Select 里面就没有错误 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询