在一个QUERY设计中插入,更新,删除 [英] INSERT,UPDATE,DELETE in one QUERY Design
本文介绍了在一个QUERY设计中插入,更新,删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你可以帮我转换这个SQL查询来访问查询,
i不知道这是否适用于访问中的一个查询设计
can you help me convert this SQL query to access query,
i dont know if this is working in one query design in access
DELETE FROM tblReportTempData
INSERT INTO tblReportTempData
(fxQuestionnaire,fxNewID)
SELECT fxQuestionnaire,newid()
FROM dbo.tblTestPaper
WHERE (fxTestCode = @fxTestCode)
order by newid()
SELECT * FROM tblReportTempData order by fxNewID
推荐答案
据我所知,这不可能在Access中的单个查询中执行多个语句。
As far as I know, this is not possible to execute multiple statements in one single query in Access.
没有等价物MS Access中的NEWID()函数。如果要创建全局唯一标识符,则需要创建 VBA函数 [ ^ ]。
另一个区别:如何MS Access继续参数 [ ^ 。参数用于查询询问用户输入 [ ^ ]
最后,查询应该看起来喜欢:
There is no equivalent NEWID() function in MS Access. If you want to create global unique identifier, you need to create VBA function[^].
Another difference: How to MS Access proceed with parameters[^]. Parameters are used to make a query ask user for input[^]
Finally, query should looks like:
PARAMETERS fxTestCode INT
DELETE FROM tblReportTempData;
INSERT INTO tblReportTempData (fxQuestionnaire,fxNewID)
SELECT fxQuestionnaire, GUID() AS fxNewID
FROM tblTestPaper
WHERE fxTestCode = [fxTestCode]
ORDER BY GUID();
SELECT *
FROM tblReportTempData
ORDER BY fxNewID;
另一个
Another
U可以使用存储过程或视图....
U can use stored procedure or view for this....
这篇关于在一个QUERY设计中插入,更新,删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文