无法使用架构名称更新表值

时间:2016-10-14 10:18:34

标签: sql dml

CREATE TABLE DBD_D_155150401111052.STUDENT(
    STUDENT_ID VARCHAR(20) NOT NULL,
    PRIMARY KEY (STUDENT_ID),
    STATE_ID CHAR(3),
    CONSTRAINT STATE_ID FOREIGN KEY (STATE_ID) REFERENCES DBD_D_155150401111052.PROPINSI (STATE_ID),
    CITY_ID CHAR(3),
    CONSTRAINT CITY_ID FOREIGN KEY (CITY_ID) REFERENCES DBD_D_155150401111052.KOTA (CITY_ID),
    NAME VARCHAR(45),
    BIRTH_DATE DATE,
    COURSE VARCHAR(10)
    );

INSERT INTO DBD_D_155150401111052.STUDENT (STUDENT_ID, NAME, BIRTH_DATE, CITY_ID, STATE_ID, COURSE)
VALUES  ('1111171', 'DEMILOV', '1997-05-01', 'A01', '001', 'SI-A'),
        ('1111172', 'MICHAEL', '1996-03-20', 'A01', '001', 'SI-A'),
        ('1111181', 'IRVING', '1998-10-14', 'C01', '003', 'IF-B'),
        ('1111182', 'JHON', '1998-08-15', 'B01', '002', 'IF-C'),
        ('1111191', 'THEODORE', '1996-01-02', 'A03', '001', 'IF-A'),
        ('1111192', 'SALLY', '1995-12-31', 'A02', '001', 'SI-B'),
        ('1111212', 'JASON', '1997-07-28', 'A02', '001', 'IF-B'),
        ('1111213', 'DAVID', '1998-11-11', 'B02', '002', 'IF-C'),
        ('1111214', 'JAMES', '1997-12-12', 'C01', '003', 'SI-B'),
        ('1111215', 'HELENA', '1996-06-08', 'C01', '003', 'IF-B');


UPDATE TABLE DBD_D_155150401111052.STUDENT
SET COURSE = 'SI-B'
WHERE STUDENT_ID = '1111171';

我无法执行上一次查询。 警告说"加入"我预计会代替"。#34;但我不知道如何修复它。 表值不能更新,因为表名包含模式,有没有办法更新值?

2 个答案:

答案 0 :(得分:1)

TABLE不是UPDATE语法的一部分。我建议你试试:

UPDATE DBD_D_155150401111052.STUDENT
    SET COURSE = 'SI-B'
    WHERE STUDENT_ID = '1111171';

答案 1 :(得分:1)

Table 是一个保留字试试这个:

UPDATE [DBD_D_155150401111052.STUDENT]
SET COURSE = 'SI-B'
WHERE STUDENT_ID = '1111171';