查询SQL代码 [英] Query SQL code
问题描述
有没有办法(函数)从查询中动态提取SQL代码?
我必须写一些非常复杂的查询,我想做什么查询设计器,但之后运行它们嵌入在VBA中。
我认为应该可以,在运行时使用函数来获取
- 获取SQL - 查询代码
- 清理/格式化
- 运行它
谢谢
Is there a way (function) to extract dynamically the SQL-code out of a query ?
I have to write some very complex queries, what I would like to do in the query-designer, but run them afterwards embedded in VBA.
I thought it should be possible, at runtime with a function to
- get the SQL-code out of the query
- clean it up / format it
- runsql it
Thanks
推荐答案
有没有一种方法(函数)可以从查询中动态提取SQL代码?
>
我必须写一些非常复杂的查询,我想在查询设计器中做什么,但之后运行它们嵌入在VBA中。
我认为它应该可以,在运行时使用函数来获取
- 从查询中获取SQL代码
- 清理它/格式化
- runsql it
谢谢
Is there a way (function) to extract dynamically the SQL-code out of a query ?
I have to write some very complex queries, what I would like to do in the query-designer, but run them afterwards embedded in VBA.
I thought it should be possible, at runtime with a function to
- get the SQL-code out of the query
- clean it up / format it
- runsql it
Thanks
继续在查询设计器中设计您的查询,摆弄它以使其完全正确,保存它以使其优化(如果您愿意),重新打开它,转到SQL视图,复制SQL并将其作为字符串粘贴到您的VBA中并运行字符串runqsl!
Jim
Hi,
Go ahead and design your query in query-designer, fiddle with it to get it exactly right, save it to get it optimized (if you wish), re-open it, go to SQL View, Copy the SQL and paste it into your VBA as a string and runqsl the string!
Jim
继续在查询设计器中设计您的查询,摆弄它以使其完全正确,保存它是为了优化它(如果你愿意),重新打开它,转到SQL视图,复制SQL并将其作为字符串粘贴到你的VBA中并运行字符串runqsl!
Jim
Hi,
Go ahead and design your query in query-designer, fiddle with it to get it exactly right, save it to get it optimized (if you wish), re-open it, go to SQL View, Copy the SQL and paste it into your VBA as a string and runqsl the string!
Jim
我知道,但我认为有可能在运行时将SQL从查询中删除。特别是因为我知道必须清理SQL代码(删除Carriage-return a.s.o)。不是这样的吗?
可以按原样运行吗?
谢谢
Hi, I know that, but thought that it might be possible to get the SQL out of the query at runtime. Especially because I understood that the SQL-code has to be cleaned (removing Carriage-return a.s.o). Isn''t that the case ?
Can it been run as-is ?
Thanks
我知道,但认为有可能在运行时从查询中获取SQL。特别是因为我知道必须清理SQL代码(删除Carriage-return a.s.o)。不是这样的吗?
可以按原样运行吗?
谢谢
Hi, I know that, but thought that it might be possible to get the SQL out of the query at runtime. Especially because I understood that the SQL-code has to be cleaned (removing Carriage-return a.s.o). Isn''t that the case ?
Can it been run as-is ?
Thanks
很可能,因为查询是一个对象,但对不起我不是知道如何。
Jim
Very probably, since the query is an Object, but I''m sorry I don''t know how.
Jim
这篇关于查询SQL代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!