is it possible to select EXISTS directly as a bit?

Posted by jcollum on Stack Overflow See other posts from Stack Overflow or by jcollum
Published on 2010-05-03T17:03:40Z Indexed on 2010/05/03 17:08 UTC
Read the original article Hit count: 139

Filed under:
|

I was wondering if it's possible to do something like this (which doesn't work):

select cast( (exists(select * from theTable where theColumn like 'theValue%') as bit)

Seems like it should be doable, but lots of things that should work in SQL don't ;) I've seen workarounds for this (SELECT 1 where... Exists...) but it seems like I should be able to just cast the result of the exists function as a bit and be done with it.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server