简体   繁体   中英

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.

How can I cast the above to Int?

using the above dataset to make a parameter

error message = Conversion failed when converting the varchar value 'Department' to data type 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

When you do

 UNION Select '0' , 'Department Flag' 

your 'Department Flag' need to be converted to int .

To fix this issue your column should have varchar type, so your code should look like this:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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