I have made three tables:
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)
)
Then I tried to fill them:
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
In such way I filled region_ and city_ tables, but I have three errors:
wrong syntax near keyword "OF".
Any ideas?
its off
SET IDENTITY_INSERT country_ OFF
you can read about this statement here
as you can see, the syntax includes OFF
SET IDENTITY_INSERT [ database. [ owner. ] ] { table } { ON | OFF }