tags:

views:

59

answers:

2

Hi all, I have problem with setting the formula in particular field.I am using sql database have been added from->add new item->sql database.I have orders table with following field ordernum primary key orderdate smalldatetime, custemail varchar(50), subtotal money, salestax money, shipping money, total AS(subtotal+salestax+shipping)

How to set this total formula,there is no datatype mentioned in total field.

Thanks, Habib

+1  A: 

This example should illustrate what you are looking to achieve.

  create table #table
    (
        ordernum int identity(1,1) primary key,
        orderdate smalldatetime,
        custemail varchar(50),
        subtotal money, 
        salestax money, 
        shipping money, 
        total AS(subtotal+salestax+shipping)
    )

    insert into #table
    (
        orderdate,
        custemail,
        subtotal, 
        salestax, 
        shipping 
    )
    select
        getDate(),
        '[email protected]',
        1.00,
        1.00,
        1.00

    select * from #table

    drop table #table

cheers, John

John Sansom
A: 

i had try, it very good.