Saturday, February 25, 2012

Add Formula for a column

I'm trying to add a formula to a column in a Table, in Enterprise Manager,
but I'm not being allowed.
I want a column to be multiplication of two other columns, datatypes money
and decimal.
I'm typing SubTotal * TaxRate ...
What's the big deal with this?
Hi Calvin
As per my knowledge you cannot add formula to the table. You can do this in
your query.
If u feel you use the formula frequently, u can create a VIEW of UDF
Hope this will solve your problem.
Thanks and regards
Chandra
"Calvin" wrote:

> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>
>
|||Try using Query Analyzer and execute the CREATE TABLE statement instead, then you can post an error
message for us. Below work fine on my machine:
CREATE TABLE #t
(subtotal decimal(5,3)
,taxrate int
,x AS subtotal*taxrate)
An alternative is to present derived information in views instead of in the table...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Calvin" <calvin@.discussions.microsoft.com> wrote in message
news:BE975F7D.1622%calvin@.discussions.microsoft.co m...
> I'm trying to add a formula to a column in a Table, in Enterprise Manager,
> but I'm not being allowed.
> I want a column to be multiplication of two other columns, datatypes money
> and decimal.
> I'm typing SubTotal * TaxRate ...
> What's the big deal with this?
>
|||Yeah... realized that would save the hassle after my post. Thanks for your
reply.
On 29/4/05 7:06 am, in article
5042C552-DDBF-4D63-BE77-C8B6ECDAF946@.microsoft.com, "Chandra"
<Chandra@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
> Hi Calvin
> As per my knowledge you cannot add formula to the table. You can do this in
> your query.
> If u feel you use the formula frequently, u can create a VIEW of UDF
> Hope this will solve your problem.
> Thanks and regards
> Chandra
>
> "Calvin" wrote:
|||Decided to change the query which updates the table instead, but thanks fr
your reply.
On 29/4/05 9:19 am, in article O6qYcQJTFHA.3056@.TK2MSFTNGP14.phx.gbl, "Tibor
Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote:

> Try using Query Analyzer and execute the CREATE TABLE statement instead, then
> you can post an error
> message for us. Below work fine on my machine:
> CREATE TABLE #t
> (subtotal decimal(5,3)
> ,taxrate int
> ,x AS subtotal*taxrate)
> An alternative is to present derived information in views instead of in the
> table...

No comments:

Post a Comment