怎样建立临时表?(100分)

J

jiarui

Unregistered / Unconfirmed
GUEST, unregistred user!
我在一篇关于SQL数据库查询优化方面的文章中看到,使用临时表加速查询的内容,
其中代码如下:
selest cust.name,rcvbles.balance,......other columns
from cust.db,rcvbles.db
where cust.customer_id-rcvlbes.customer_id
and revbles.blance>0
order by cust.name
into temp cust_with_balance
//cust_with_balance为准备建立临时表
//cust.db,rcvbles.db为持查询的表
请问大侠,我在D6的SQL中使用为什么会出现错误?
错在哪 ?
错误提示:
Invalid use of Keyword
Token: into
Line Number:6
 
我看你的查询有语法错误,你先在SQL的查询分析器里调试好了再往Delphi 里贴。
 
cust.customer_id=rcvlbes.customer_id
into cust_with_balance
 
order by cust.name 应该在最后把
 
selest cust.name,rcvbles.balance,......other columns
into #temp cust_with_balance
from cust.db,rcvbles.db
where cust.customer_id-rcvlbes.customer_id
and revbles.blance>0
order by cust.name
 
大家说的都不对呀!
Invalid use of Keyword
Token: into
说明是INTO函数的错误。
按大家说的,最简单改成
select *
INTO #temp b.db
from a.db
还是错的。
 
没人帮忙吗?
 
建立臨時表應該是
select 字段 into ##temptable from 表
這樣的格式吧
 
创建临时表应该是这样吧:
select *
INTO #test
from a.db
 
注意 ADOQuery 不要打开要执行。
 
是PARADOX表呀上面的方法全不行
 
Paradox 的 local SQL不支持你的操作
不能 select ... into
可以 insert into ... select ...
另外Local SQL 没有临时表的概念
 
在SQL SERVER中使用临时表格式如下:
SELECT 字段 FROM TABEL(永久表) WHERE 条件 INTO #TEMP_TABLE(臨時表)
 

Similar threads

I
回复
0
查看
449
import
I
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
顶部