【问题标题】:Alternate in access database [duplicate]访问数据库中的备用[重复]
【发布时间】:2023-03-11 08:01:01
【问题描述】:

我想在 Access 2007 中插入新行之前检查一行是否存在。
我在 SQL Server 中有以下工作查询,但无法将其转换为 Access。

update category set name='hell' where categoryid=287
if @@rowcount=0
begin
insert into category(categoryid,name,path,parentcategoryid,creationdate) values (287,'a','a',12,'')
end

【问题讨论】:

  • 我想在 access 2007 中插入新行之前检查一行是否存在。任何帮助将不胜感激
  • 问题出在哪里?

标签: database-design ms-access


【解决方案1】:

试试这个

update category set name='hell' where categoryid=287;

if not exists(select * from Category where categoryid=287)
    insert into category(categoryid,name,path,parentcategoryid,creationdate) 
values (287,'a','a',12,'');

【讨论】:

    猜你喜欢
    • 2017-01-01
    • 2017-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多