将jet-sql访问列转换为sql server

时间:2018-02-21 13:50:57

标签: sql-server tsql access jet-sql

如何在我的sql server列中转换此计算列ACCESS?

            ->add(
                'images',
                'sonata_type_model',
                array('expanded' => false, 'by_reference' => true, 'multiple' => true, 'required' => false),
                array('link_parameters' => array(
                    'context' => 'default',
                    'provider' => 'sonata.media.provider.image'))
            )

谢谢

1 个答案:

答案 0 :(得分:0)

您的问题缺少上下文,但这里是一个具有以下条件的计算列的演示:

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

You can see a live demo on rexteser.