简体   繁体   中英

convert jet-sql access column calculated into sql server

how to convert this calculated column ACCESS in my sql server column?

([VratePctg] < 0.05) Or (Abs([Amount1]) < 1) Or (Abs([Amount2]) < 1)

Thank you

Your question lacks context, but here is a demo of a computed column with these conditions:

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)
)

Test:

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

Results:

VratePctg   Amount1     Amount2     ComputedColumn
0,03        2           5           True
0,60        7           4           False
0,90        0           8           True
4,20        9           0           True

You can see a live demo on rexteser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM