Better alternative to CAST(0 as bit)?

  • I am tired of writing "CAST(0 as bit)" or "CAST(1 as bit)" whenever I need a constant that is typed as a bit. In many computer languages (e.g. C++, C#), you can add a suffix to a number to specify its type. Does anyone know if SQL has this? If not, is there a better way to write this?

  • Define a variable with type "bit" and assign the value to that. That's what I do.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • I do what GSquared does. Define a var.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply