全国省市SQL数据表.docx
《全国省市SQL数据表.docx》由会员分享,可在线阅读,更多相关《全国省市SQL数据表.docx(59页珍藏版)》请在冰豆网上搜索。
![全国省市SQL数据表.docx](https://file1.bdocx.com/fileroot1/2022-10/29/370e7058-008f-4df0-8750-02309da684e3/370e7058-008f-4df0-8750-02309da684e31.gif)
全国省市SQL数据表
droptableTProvinceAndCity
GO
CreateTableTProvinceAndCity
(
PKeyintidentity(1,1)notnull,
Provincenvarchar(32)null,
Citynvarchar(32)null
)
Go
BEGINTRANSACTION;
SELECTTOP10FROMTProvinceAndCityWITH(HOLDLOCK,TABLOCK);
DISABLETRIGGERALLONTProvinceAndCity;
SETIDENTITY_INSERTTProvinceAndCityON;
BEGINTRY
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=1)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'西城区'WHERE[Pkey]=1;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(1,N'北京市',N'西城区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=2)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'崇文区'WHERE[Pkey]=2;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(2,N'北京市',N'崇文区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=3)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'宣武区'WHERE[Pkey]=3;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(3,N'北京市',N'宣武区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=4)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'朝阳区'WHERE[Pkey]=4;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(4,N'北京市',N'朝阳区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=5)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'丰台区'WHERE[Pkey]=5;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(5,N'北京市',N'丰台区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=6)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'石景山区'WHERE[Pkey]=6;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(6,N'北京市',N'石景山区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=7)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'海淀区'WHERE[Pkey]=7;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(7,N'北京市',N'海淀区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=8)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'门头沟区'WHERE[Pkey]=8;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(8,N'北京市',N'门头沟区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=9)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'房山区'WHERE[Pkey]=9;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(9,N'北京市',N'房山区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=10)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'通州区'WHERE[Pkey]=10;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(10,N'北京市',N'通州区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=11)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'顺义区'WHERE[Pkey]=11;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(11,N'北京市',N'顺义区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=12)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'昌平区'WHERE[Pkey]=12;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(12,N'北京市',N'昌平区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=13)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'大兴区'WHERE[Pkey]=13;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(13,N'北京市',N'大兴区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=14)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'怀柔区'WHERE[Pkey]=14;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(14,N'北京市',N'怀柔区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=15)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'平谷区'WHERE[Pkey]=15;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(15,N'北京市',N'平谷区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=16)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'密云县'WHERE[Pkey]=16;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(16,N'北京市',N'密云县');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=17)
UPDATE[TProvinceAndCity]SETProvince=N'北京市',City=N'延庆县'WHERE[Pkey]=17;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(17,N'北京市',N'延庆县');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=18)
UPDATE[TProvinceAndCity]SETProvince=N'上海市',City=N'黄浦区'WHERE[Pkey]=18;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(18,N'上海市',N'黄浦区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=19)
UPDATE[TProvinceAndCity]SETProvince=N'上海市',City=N'卢湾区'WHERE[Pkey]=19;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(19,N'上海市',N'卢湾区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=20)
UPDATE[TProvinceAndCity]SETProvince=N'上海市',City=N'徐汇区'WHERE[Pkey]=20;
ELSE
INSERT[TProvinceAndCity](Pkey,Province,City)VALUES(20,N'上海市',N'徐汇区');
IFEXISTS(SELECTTOP10FROM[TProvinceAndCity]WHERE[Pkey]=