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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 "Expressions as a datatype for a table column"

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-06-02 : 08:26:11
Bob writes "Recently I was able to define a simple expression as a table data type; that is instead of the usual int, char, etc. I did the following and it worked like a charm.
AS ([covalimit] + [covblimit] + [covclimit] + [covdlimit]). It summed four columns in the table and put the result in this column. I also did AS (Checksum[ColA + ColB + ColC]) and it worked like a charm.

What I am looking for are more sophisticated examples of expressions in which I can do the following:
AS (UPDATE staging_final_test
SET wind_ded_new =
CASE
WHEN (wind_ded NOT IN (100,250,500,1000,2000,2500,3000,4000,5000,10000))
THEN wind_ded_new = (wind_ded/covalimit)
ELSE wind_ded
END)
I have tried to define this as an expression and other forms of the same logic and have been unsuccessful in implementing this or other forms of intelligent logic.

I have not been able to locate examples of this type of intelligent expression used in a table column, but it would appear from SQL Server Books that any SQL Expression is applicable to table columns. What are the limitations of expressions in columns and where may I find syntactically correct examples of legitimate expressions.

Any assistance you can provide would be greatly appreciated.

Thank you,
Bob"

SamC
White Water Yakist

3467 Posts

Posted - 2005-06-02 : 09:35:08
quote:
Originally posted by AskSQLTeam

I have tried to define this as an expression and other forms of the same logic and have been unsuccessful in implementing this or other forms of intelligent logic.
Can you post an example that doesn't work?
Go to Top of Page
   

- Advertisement -