简体   繁体   English

SSRS CAST UNION Report Builder 3.0

[英]SSRS CAST UNION Report Builder 3.0

I have the following at the end of a script. 我在脚本末尾有以下内容。 it is the union causing the issue 是造成问题的工会

it evolves a Department Flag... that there is a 它会演变成一个部门标志...

case when... 1 else 0

At the end I have .... 最后我有....

UNION
Select '0' , 'Department Flag'

the error I have is with Int. 我的错误是Int。

How can I cast the above to Int? 如何将以上内容转换为Int?

using the above dataset to make a parameter 使用上述数据集制作参数

error message = Conversion failed when converting the varchar value 'Department' to data type int 错误消息=将varchar值“部门”转换为数据类型int时转换失败

please help 请帮忙

case when... 1 else 0

Here the type of the column is int , it's defined by the value 0 which is int 这里列的类型是int ,它是由值0定义的,它是int

When you do 当你做

 UNION Select '0' , 'Department Flag' 

your 'Department Flag' need to be converted to int . 您的'Department Flag'需要转换为int

To fix this issue your column should have varchar type, so your code should look like this: 要解决此问题,您的列应具有varchar类型,因此您的代码应如下所示:

case when... 1 else '0' -- here 0 is not int but varchar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM