建表语句,如何让一个字段的公式为某两个字段的积?

jonason6 2003-01-20 03:55:55
如:
create table eq_material (
id int identity not null,
MendNo varchar(16) not null, --维、报修编号
IsReport char(2) null, --是否用户报修
Material varchar(64) null, --材料名
UnitPrice money null, --单价
Quantity int null, --数量
total float null, --小计
constraint PK_EQ_MATERIAL primary key (id,MendNo)
)

我想把total的值公式设为UnitPrice*Quantity
...全文
50 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
CrazyFor 2003-01-20
  • 打赏
  • 举报
回复
create table eq_material (
id int identity not null,
MendNo varchar(16) not null, --维、报修编号
IsReport char(2) null, --是否用户报修
Material varchar(64) null, --材料名
UnitPrice money null, --单价
Quantity int null, --数量
total flot as Unitprice*Quantity, --小计
constraint PK_EQ_MATERIAL primary key (id,MendNo)
)

我想把total的值公式设为UnitPrice*Quantity
蓝天 2003-01-20
  • 打赏
  • 举报
回复
create table eq_material (
id int identity not null,
MendNo varchar(16) not null, --维、报修编号
IsReport char(2) null, --是否用户报修
Material varchar(64) null, --材料名
UnitPrice money null, --单价
Quantity int null, --数量
total as UnitPrice*Quantity

constraint PK_EQ_MATERIAL primary key (id,MendNo)
)

34,870

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧