sql computed column

Norman Maina
Norman Maina used Ask the Experts™
on
Hello,

I am trying to have a column with a bit datatype to be a calculated column.

what am trying to achieve is to automaticaly change the value of the column to either True or False depending on where a view that checks quantities in another table has zero balances or not.


Thanks in advance,
Norman
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
You can create user defined function that will do the check and use it for the calculated column.

I would be careful though - you can have performance issues if you constantly accessing that column (like via select * from..).
Commented:
You can do this with a user defined function, but I would be careful because when you go to change it or change the function, you have to drop the column and re-add it.

On a production system, it can get pretty dicey changing it out.

But if you want to know how to do this:
http://www.sqlservercentral.com/articles/User+Defined+Function+(UDF)/udfascomputedcolumn/1025/

Author

Commented:
Thanks guys -I was going that direction but changed my mind.Learnt quite abit about calcu;ated columns though :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial