gpt4 book ai didi

SQL 输出语法

转载 作者:行者123 更新时间:2023-12-03 02:20:12 25 4
gpt4 key购买 nike

虽然我认为这是一个相当简单的查询,但显然“‘输出’附近的语法不正确”。其他在线资源对调试此问题没有帮助。

我在这里做错了什么?

DECLARE @changes TABLE (client_id_copy INT, client_id INT);

UPDATE gmdev.contacts
SET client_id_copy=a.client_id
FROM gmdev.profile a, gmdev.contacts b
output client_id_copy, inserted.client_id into @changes
WHERE a.custid=b.custid
and NOT(Client_ID_copy > '')
and b.custid in
(select custid from gmdev.profile where custtype='EZ2');

编辑:

以下建议不起作用:

DECLARE @changes TABLE (client_id_copy INT, client_id INT);

UPDATE gmdev.contacts
SET client_id_copy=a.client_id
OUTPUT client_id_copy, inserted.client_id into @changes
FROM gmdev.profile a, gmdev.contacts b
WHERE a.custid=b.custid
and NOT(Client_ID_copy > '')
and b.custid in
(select custid from gmdev.profile where custtype='EZ2');

最佳答案

DECLARE @changes TABLE (client_id_copy INT, client_id INT);

UPDATE gmdev.contacts
SET client_id_copy=a.client_id
output inserted.client_id_copy, inserted.client_id into @changes
FROM gmdev.profile a, gmdev.contacts b
WHERE a.custid=b.custid
and NOT(Client_ID_copy > '') -- Weird...
and b.custid in
(select custid from gmdev.profile where custtype='EZ2');

关于SQL 输出语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16985200/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com