sql插入值无法绑定多部分标识符
我正在尝试运行这个命令,它应该附加 80 行..但我明白了。
消息 4104,16 级,状态 1,第 1 行 无法绑定多部分标识符“Frame.Guid”。
INSERT INTO studentrecords(recordGuid, studentGuid, courseGuid, licenseGuid, repeatflag, frameGuid, coredata, framescore, timeinframe, locked, daterefreshed, dateinserted)
VALUES (NEWID(), '25d6e1d9-e5ce-42dd-bd6a-5956ec7cb047', '54dffd58-1af9-44cf-982e-ea0e8930878e', '00000000-1111-1111-0000-000000000000', 0, Frame.Guid, '<flags><flag1>1</flag1> <flag2>1</flag2> <flag3>1</flag3> <flag4>1</flag4> <flag5>1</flag5><flag6>1</flag6></flags><StudentAnswer> <CorrectionHistory></CorrectionHistory> </StudentAnswer>', 0, 55860, 1, GETDATE(), GETDATE())
Select Frame.Guid FROM Frame
WHERE (Frame.Course = '54dffd58-1af9-44cf-982e-ea0e8930878e') AND (Frame.Template <> '7d3a3b40-86e3-43f4-a4ca-039afdd0b7a3')
I am trying to run this command which shoulld append 80 rows.. but i get.
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "Frame.Guid" could not be bound.
INSERT INTO studentrecords(recordGuid, studentGuid, courseGuid, licenseGuid, repeatflag, frameGuid, coredata, framescore, timeinframe, locked, daterefreshed, dateinserted)
VALUES (NEWID(), '25d6e1d9-e5ce-42dd-bd6a-5956ec7cb047', '54dffd58-1af9-44cf-982e-ea0e8930878e', '00000000-1111-1111-0000-000000000000', 0, Frame.Guid, '<flags><flag1>1</flag1> <flag2>1</flag2> <flag3>1</flag3> <flag4>1</flag4> <flag5>1</flag5><flag6>1</flag6></flags><StudentAnswer> <CorrectionHistory></CorrectionHistory> </StudentAnswer>', 0, 55860, 1, GETDATE(), GETDATE())
Select Frame.Guid FROM Frame
WHERE (Frame.Course = '54dffd58-1af9-44cf-982e-ea0e8930878e') AND (Frame.Template <> '7d3a3b40-86e3-43f4-a4ca-039afdd0b7a3')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不明白你希望这里的“插入”和“选择”查询如何相关——它们在语法上都是完整的,但没有以任何方式链接。您期望第一个查询中的“Frame.Guid”以某种方式来自第二个查询,但我不太明白如何实现。无论如何,这就是错误消息所说的全部内容;它无法准确地告诉您 Frame.Guid 的含义。
I can't see how you want the "insert" and "select" queries here to be related -- they're both syntactically complete but not linked in any way. You're expecting "Frame.Guid" in the first query to come from the second query, somehow, but I can't quite get how. In any case, that's all that the error message is saying; it can't tell what you mean by Frame.Guid, exactly.
您在插入语句中引用了 Frame.Guid,但没有定义。我怀疑您想将该值选择到变量中,然后在插入语句中使用该变量。
You're referencing
Frame.Guid
in the insert statement, but there isn't one defined. I suspect you want to select that value into a variable, then use the variable in the insert statement.你那里有两个陈述。
INSERT
语句无法知道您是否希望字段Frame.Guid
脱离SELECT
语句。您需要将其重构为一条语句。您可以通过将所有常量放入
SELECT
语句中(在SELECT
和FROM
之间)并删除VALUES
来实现此目的> 条款。那么这将是一个声明。You have two statements there. The
INSERT
statement has no way of knowing that you want the fieldFrame.Guid
out of theSELECT
statement.You need to refactor it into one statement. You can do that by putting all the constants into the
SELECT
statement (betweenSELECT
andFROM
) and deleting theVALUES
clause. Then it will be one statement.