插入代码

时间:2017-11-13 23:53:59

标签: sql insert

所以我试图运行这段代码它没有用。 任何人都可以告诉我它有什么问题吗?

INSERT INTO (LocationID,LocationLatitude, LocationLongitude)
VALUES (1,39.7392° N,104.9903° W),
(2,39.6172° N,104.9508° W),
(3,39.5807° N,104.8772° W),
(4,38.8339° N,104.8214° W),
(5,40.5853° N,105.0844° W)

1 个答案:

答案 0 :(得分:1)

假设map()LocationID自动递增而其他列为Indentity Column

编辑:OP的评论表明VARCHAR不是LocationID

Identity

当前SQL的问题是缺少表,数据类型无效,列数太多/数据值太少,INSERT INTO Location (LocatioNID, LocationLatitude, LocationLongitude) VALUES (1, '39.7392° N', '104.9903° W'), (2, '39.6172° N', '104.9508° W'), (3, '39.5807° N', '104.8772° W'), (4, '38.8339° N', '104.8214° W'), (5, '40.5853° N', '105.0844° W') cols太小等等。

此外,您可能希望阅读有关空间数据的信息:https://www.red-gate.com/simple-talk/sql/t-sql-programming/introduction-to-sql-server-spatial-data/