Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie Question - Data Type for Calculated Field

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
In SQL 2000, is it possible to create a calculated table field that automatically calculates a value based on other table fields? Or must such a calculation be performed in the front-end application?

Thanks.

--
Mike
 
You can create a column field is computed based on other fields in the same table. Check out CREATE TABLE in BOL and scroll down to computed_column_expression. Examples H and I show you the T-SQL code. If you want a computed column based on values in another table, I believe you will need to use a trigger. Good luck!

--John [rainbow]
-----------------------------------
Behold! As a wild ass in the desert
go forth I to do my work.
--Gurnie Hallock (Dune)
 
JohnDTampaBay,

Thanks for the info. One question - What is BOL?

--
Mike
 
Books Online - the SQL Server help files.

Questions about posting. See faq183-874
 
Here's more information on BOL.

BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine

-SQLBill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top