-1

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

Erik A
  • 31,639
  • 12
  • 42
  • 67
sebyrock
  • 29
  • 6

1 Answers1

0

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.

Zohar Peled
  • 79,642
  • 10
  • 69
  • 121
  • the problem is that I had to calculate on two calculated columns, I had to replace the expression instead of the column name. Thank you – sebyrock Feb 22 '18 at 10:48