December 15, 2010 at 9:56 pm
Hi experts,
In the below case statement, the Salespersonflag column is being returned. when i use this case statement in a select and use that statement in a SSIS package i see the output column datatype for salespersonflag is DT_14. I want the case statement to return a DT_BOOL which is a bit datatype. can any one help me?
CASE
WHEN sp.[SalesPersonID] IS NULL THEN cast(0 as bit)
ELSE cast(1 as bit)
END AS [SalesPersonFlag]
I have tried the below options but did not work.
1. use cast/convert to the entire case statement.
2. using cast for 1 and 0 values that are being shown as above.
But the end result shown is as DT_14 in my package metadata. Appreciate your inputs on how to get the case statement returning a bit value.
Thanks
Koti
December 15, 2010 at 10:54 pm
Not sure but try this
CAST(CASE
WHEN sp.[SalesPersonID] IS NULL THEN 0
ELSE 1
END AS BIT)AS [SalesPersonFlag]
--------------------------------------------------------------------------------------------------
I am just an another naive wannabe DBA trying to learn SQL Server
December 16, 2010 at 5:09 am
🙂 I have tired that option too but the same.
December 16, 2010 at 5:32 am
--edited, as a duped answer that does not work....
Lowell
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply