我制作了三张桌子:
CREATE TABLE country_ (
id_country int NOT NULL IDENTITY(219,1),
oid int NOT NULL,
country_name_ru varchar(50) NOT NULL,
country_name_en varchar(50) NOT NULL,
PRIMARY KEY (id_country)
)
CREATE TABLE region_ (
id_region int NOT NULL IDENTITY(1612,1),
id_country int NOT NULL FOREIGN KEY REFERENCES country_(id_country),
oid int NOT NULL,
region_name_ru varchar(255) NOT NULL,
region_name_en varchar(255) NOT NULL,
PRIMARY KEY (id_region)
)
CREATE TABLE city_ (
id_city int NOT NULL IDENTITY(17590,1),
id_region int NOT NULL FOREIGN KEY REFERENCES region_(id_region),
id_country int NOT NULL FOREIGN KEY REFERENCES country_(id_country),
oid int NOT NULL,
city_name_ru varchar(255) NOT NULL,
city_name_en varchar(255) NOT NULL,
PRIMARY KEY (id_city)
)
然后我试着填写它们:
SET IDENTITY_INSERT country_ ON
INSERT INTO country_ ( id_country,oid,country_name_ru,country_name_en) VALUES (1, 3159, 'Россия', 'Russia');
SET IDENTITY_INSERT country_ OF
这样我填写了region_和city_表,但我有三个错误:
关键字“OF”附近的语法错误。
有什么想法吗?
答案 0 :(得分:1)
关闭
SET IDENTITY_INSERT country_ OFF
您可以阅读此声明here
如您所见,语法包括OFF
SET IDENTITY_INSERT [ database. [ owner. ] ] { table } { ON | OFF }