如何在我的 sql server 列中转换此计算列 ACCESS?
([VratePctg] < 0.05) Or (Abs([Amount1]) < 1) Or (Abs([Amount2]) < 1)
谢谢
如何在我的 sql server 列中转换此计算列 ACCESS?
([VratePctg] < 0.05) Or (Abs([Amount1]) < 1) Or (Abs([Amount2]) < 1)
谢谢
您的问题缺乏上下文,但这里是具有以下条件的计算列的演示:
CREATE TABLE Demo
(
VratePctg decimal(5,2),
Amount1 int,
Amount2 int,
ComputedColumn AS CAST(CASE WHEN [VratePctg] < 0.05 Or Abs([Amount1]) < 1 Or Abs([Amount2]) < 1 THEN 1 ELSE 0 END As Bit)
)
测试:
INSERT INTO Demo(VratePctg, Amount1, Amount2) VALUES
(0.03, 2, 5),
(0.6, 7, 4),
(0.9, 0, 8),
(4.2, 9, 0)
SELECT *
FROM Demo
结果:
VratePctg Amount1 Amount2 ComputedColumn
0,03 2 5 True
0,60 7 4 False
0,90 0 8 True
4,20 9 0 True