2015-08-18 52 views
1

我想在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 
+1

在哪裏的問題? – Shnugo

+0

在訪問2007中插入新行之前,我想檢查一行是否存在。任何幫助將不勝感激 –

回答

0

試試這個

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,'');