我已经通过Liquibase将Oracle数据库迁移到了Microsoft SQL Server,但仍有一些SQL语句不起作用。这个在甲骨文里是这样的:
CREATE OR REPLACE VIEW "BP_RESULTS_VIEW" (
BP_ID,
RES_NAME,
RES_LONG_NAME,
MEDIAN,
LOW_HINGE,
HIGH_HINGE,
H_SPREAD,
INNER_FENCE_LOW,
INNER_FENCE_HIGH,
OUTER_FENCE_LOW,
OUTER_FENCE_HIGH,
LOW_NOTCH,
HIGH_NOTCH,
LOW_ADJACENT_VALUE,
HIGH_ADJACENT_VALUE)
AS
SELECT
r.BP_ID,
rv.RES_NAME,
rv.RES_LONG_NAME,
r.MEDIAN,
r.LOW_HINGE,
r.HIGH_HINGE,
r.H_SPREAD,
r.INNER_FENCE_LOW,
r.INNER_FENCE_HIGH,
r.OUTER_FENCE_LOW,
r.OUTER_FENCE_HIGH,
r.LOW_NOTCH,
r.HIGH_NOTCH,
r.LOW_ADJACENT_VALUE,
r.HIGH_ADJACENT_VALUE
FROM
bp_results r,
results_view_display rv
WHERE
CAST (rv.value AS INT) = r.bp_id AND
rv.type = 'BOX';
在将其迁移到Microsoft SQL Server之后,如下所示:
CREATE OR REPLACE FORCE VIEW BP_RESULTS_VIEW (BP_ID, RES_NAME, RES_LONG_NAME, MEDIAN,
LOW_HINGE, HIGH_HINGE, H_SPREAD, INNER_FENCE_LOW, INNER_FENCE_HIGH,
OUTER_FENCE_LOW, OUTER_FENCE_HIGH, LOW_NOTCH, HIGH_NOTCH,
LOW_ADJACENT_VALUE, HIGH_ADJACENT_VALUE) AS SELECT
r.BP_ID,
rv.RES_NAME,
rv.RES_LONG_NAME,
r.MEDIAN,
r.LOW_HINGE,
r.HIGH_HINGE,
r.H_SPREAD,
r.INNER_FENCE_LOW,
r.INNER_FENCE_HIGH,
r.OUTER_FENCE_LOW,
r.OUTER_FENCE_HIGH,
r.LOW_NOTCH,
r.HIGH_NOTCH,
r.LOW_ADJACENT_VALUE,
r.HIGH_ADJACENT_VALUE
FROM
bp_results r,
results_view_display rv
WHERE
CAST (rv.value AS INT) = r.bp_id AND
rv.type = 'BOX'
GO
但当我想执行它时,总是会出现以下错误:
Incorrect syntax near 'REPLACE'.
我不明白为什么,因为替换语句也存在于SQLServer中。它似乎也无法识别cast命令。我正在使用Microsoft SQL Server Management Studio 17