Monday, March 12, 2012

Expressions in calucated columns

Where can I find a list of expressions that are allowed in calculated columns?
Thanks
IT PHYTOSAN
On Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:

>Where can I find a list of expressions that are allowed in calculated columns?
Hi IT PHYTOSAN,
In Books Online, subject "CREATE TABLE":
computed_column_expression
Is an expression defining the value of a computed column. A computed
column is a virtual column not physically stored in the table. It is
computed from an expression using other columns in the same table. For
example, a computed column can have the definition: cost AS price * qty.
The expression can be a noncomputed column name, constant, function,
variable, and any combination of these connected by one or more
operators. The expression cannot be a subquery.
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Thanks,but what is the syntax? What commands are allowed?
IT PHYTOSAN
"Hugo Kornelis" wrote:

> On Mon, 3 Oct 2005 15:31:03 -0700, IT PHYTOSAN wrote:
>
> Hi IT PHYTOSAN,
> In Books Online, subject "CREATE TABLE":
> computed_column_expression
> Is an expression defining the value of a computed column. A computed
> column is a virtual column not physically stored in the table. It is
> computed from an expression using other columns in the same table. For
> example, a computed column can have the definition: cost AS price * qty.
> The expression can be a noncomputed column name, constant, function,
> variable, and any combination of these connected by one or more
> operators. The expression cannot be a subquery.
>
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
>
|||Example Script
CREATE TABLE [dbo].[Table1] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[Price] [decimal](18, 0) NOT NULL ,
[Qty] [int] NOT NULL ,
[Total] AS ([Price] * [Qty])
) ON [PRIMARY]
GO
Nik Marshall-Blank MCSD/MCDBA
Linz, Austria
"IT PHYTOSAN" <ITPHYTOSAN@.discussions.microsoft.com> wrote in message
news:B26DE2A2-2E51-4E7B-BADA-FBDE15A48004@.microsoft.com...[vbcol=seagreen]
> Thanks,but what is the syntax? What commands are allowed?
> IT PHYTOSAN
> "Hugo Kornelis" wrote:

No comments:

Post a Comment