Thursday, December 3, 2015

When returning a column from a sproc and when you wish to cast varchar data to a bit shape...

Just do something like this:

alter procedure SQL is followed with...
SELECT
x.Foo AS [MyFoo],
CASE WHEN x.Bar IS NULL THEN 'False' ELSE 'True' END AS [MyBar],
x.Baz AS [MyBaz],
y.Qux AS [MyQux],

...then yet more SQL follows

 
 

When you slurp a dataset into C# and then turn around and cast it to a POCO you will be able to map the 'False' and the 'True' to a bool type getsetter without issue.

No comments:

Post a Comment