且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

sql server 存储过程中的 CASE 语句有问题

更新时间:2023-02-07 09:45:19

这是因为 CASE 语句必须解析为单一类型.在这种情况下(没有双关语:)你正在考虑一个 nvarchar 或一个 int(我认为 [No] 是一个 int).

This is because a CASE Statement must resolve to a single type. In this case (no pun intended :) you are considering an nvarchar OR an int (I presume [No] is an int).

请参阅此处了解更多详情:一个案例中的排序方式和不同类型

See here for more details: Order by and Different Types in a CASE