Hi ,, I have an Excel file It has 2 columns ,Province And City Province column repeats Name for Each city , so it has duplicated values I want Export this file to MSSQL in MSSQL ;My table has three columns : Id(AutoGenerate) , Location(Province,City) , ProvinceId I want import just 1 column from excel like Below
province City ----------------------- P1 C1 P1 C2 P1 C3 P1 C4 P1 C5 P1 C6 P1 C7 ------------------------- P2 C1 P2 C2 P2 C3 P2 C4 P2 C5 P2 C6 P2 C7 In mssql it Must be : Id Location ProvinceId ---------------------------------------- 1 P1 0 2 C1 1 3 C2 1 4 C3 1 5 C4 1 6 C5 1 7 C6 1 8 C7 1 9 P2 0 10 C1 9 11 C2 9 12 C3 9 13 C4 9 14 C5 9 15 C6 9 16 C7 9
答案 0 :(得分:0)
我会分几步完成:
或者你需要编写更智能的sql脚本来在sql中执行此操作。