views:

39

answers:

1

I have a column along with many others that returns a int value. It is the same int value for every record in this column. If this value is 1 I need to set a variable = 1 if it is 0 i want the variable to be 0. How do I go about doing this?

There can only be a 0 or 1 in that column. And again it is the same throughout the entire column each time the query is ran.

Thanks!

+1  A: 

I'm not sure if I understood your problem correctly, but how about SET @Variable = (SELECT TOP 1 TheColumn FROM TheTable)?

Carlos