May 19, 2008 at 8:58 pm
Ok... here's the deal. I want to create a computed column that takes a base value in one table, and increments in the computed column table. For instance, in table a I have a base value of 100. In table b, when I insert a row, I want a computed column that takes the latest value and increments it by one, or if there isn't a latest value, it takes just the base value (100). Does anyone have any pointers on how to do this? :blink:
May 20, 2008 at 12:57 am
Can't be done... computed columns cannot refer to other tables.
You might be able to use a trigger to accomplish this. Why do you need to do this?
--Jeff Moden
Change is inevitable... Change for the better is not.
May 20, 2008 at 5:28 am
Yikes. So I'm going to have to store redundant data, eh? I guess I could store the base value in the same table as the computed column. I wish there were a way to do it without that though.
May 20, 2008 at 7:19 am
No... redundant data is not necessary. Like I said, you could use a trigger to pull this off.
Just curious... why do you want to do this? What is in the 2 tables that requires it... there may be another way...
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply