Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jamstar
Starting Member
1 Post |
Posted - 2007-09-05 : 06:25:09
|
Hi all, I have a table with 3 computed columns, the first two reference a function for there value. The last computed column should be total of the other computed columns, however when trying to write the formula for this column SQL Server rejects it.Am i correct in thinking it is not possible to reference other computed columns in a computed column's forumla. My current work around is to call the functions again that the other computed columns use to generate the total, though this seems to me like a performance issue.Could anyone offer some advise on my situation.Any input apreciated. |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-09-05 : 06:38:58
|
You can make the computed columns persisted.CREATE TABLE Table1(Col1 INT,Col2 AS dbo.fnMyFunction1(Col1) PERSISTED,Col3 AS dbo.fnMyFunction2(Col1) PERSISTED,Col4 AS dbo.fnMyFunction1(Col1) + dbo.fnMyFunction2(Col1) PERSISTED) E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|