Hi,
I am quering a table that has a bit field. The bit field is used to store a
boolean and I want to display this value in a data grid. Can I format(i do
not want a -1 or 0 displayed in the datagrid) this value before I return the
resultset?
ThanksWell, first off, a BIT cannot be -1. You must be thinking of Access or VB.
SELECT CASE bitColumn WHEN 1 THEN 'True' ELSE 'False' END FROM table
"jake" <jp@.broncos.com> wrote in message
news:uhRdKH20FHA.1252@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I am quering a table that has a bit field. The bit field is used to store
> a boolean and I want to display this value in a data grid. Can I format(i
> do not want a -1 or 0 displayed in the datagrid) this value before I
> return the resultset?
> Thanks
>|||While you can use a CASE statement to transform the values, you are mingling
the data layer and the presentation layer. You can just as easily perform
the same action in your client code and maintain the tier integrity. (What
if you or someone else want to call this same query in another place and kee
p
the bit values?)
Just something to consider.
John Scragg
"jake" wrote:
> Hi,
> I am quering a table that has a bit field. The bit field is used to store
a
> boolean and I want to display this value in a data grid. Can I format(i d
o
> not want a -1 or 0 displayed in the datagrid) this value before I return t
he
> resultset?
> Thanks
>
>|||> (What if you or someone else want to call this same query in another place
and > keep the bit values?)
The 'wtf-way' would be to convert the values back and forth as needed. :)
I whole-heartedly agree - things like these belong on the presentation layer
.
ML
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment