8 个解决方案
#1
select * into #T from table1
#2
select * into #Temp from table1
select * into ##Temp from table1//全局临时表
select * into ##Temp from table1//全局临时表
#3
TO wdsimon(老王),madyak(无天)
还是不行呀,我按照上面的格式写了以后,Delphi会提示一个“CommandText does not return a result set”,我用的控件ADOQuery,这是怎么回事呀!
还是不行呀,我按照上面的格式写了以后,Delphi会提示一个“CommandText does not return a result set”,我用的控件ADOQuery,这是怎么回事呀!
#4
先创建一个临时表,自己用到的一个例子:
CREATE TABLE #temp_rpt_Stock(
tmp_Customer_No varchar(50),
Item_No01 varchar(50),
Item_No02 varchar(50),
Item_No03 varchar(50),
Item_No11 varchar(50),
Item_No12 varchar(50),
Item_No13 varchar(50),
--Date_Str varchar(20),
Stock_In int,
Stock_Out int,
Stock_Out_2B int,
Stock_Else int,
Stock_Remains int,
Booker varchar(20)--first employee_no and then update to employee_name
)
CREATE TABLE #temp_rpt_Stock(
tmp_Customer_No varchar(50),
Item_No01 varchar(50),
Item_No02 varchar(50),
Item_No03 varchar(50),
Item_No11 varchar(50),
Item_No12 varchar(50),
Item_No13 varchar(50),
--Date_Str varchar(20),
Stock_In int,
Stock_Out int,
Stock_Out_2B int,
Stock_Else int,
Stock_Remains int,
Booker varchar(20)--first employee_no and then update to employee_name
)
#5
当然,临时表要和查询语句放在同一个存储过程中.最后返回结果集.
#6
ADOQUERY吗
直接写select * from table where condition
就可以返回结果集体了
with ADOQuery1 do
begin
close;
sql.clear;
sql.add(select field1,field2,... from table1)
open;
end;
就有结果了啊,
adoquery1.recordcount;//记录数;
adoquery1.fieldbyname('field1').vlaue;//当前记录fieldbyname1的值
直接写select * from table where condition
就可以返回结果集体了
with ADOQuery1 do
begin
close;
sql.clear;
sql.add(select field1,field2,... from table1)
open;
end;
就有结果了啊,
adoquery1.recordcount;//记录数;
adoquery1.fieldbyname('field1').vlaue;//当前记录fieldbyname1的值
#7
不能用ADOQuery1.OPEN,试试ADOQuery1.ExecSQL
#8
select * into #T from table1
Select * from #T
两句写在一起,再用OPEN应该也可以!
Select * from #T
两句写在一起,再用OPEN应该也可以!
#1
select * into #T from table1
#2
select * into #Temp from table1
select * into ##Temp from table1//全局临时表
select * into ##Temp from table1//全局临时表
#3
TO wdsimon(老王),madyak(无天)
还是不行呀,我按照上面的格式写了以后,Delphi会提示一个“CommandText does not return a result set”,我用的控件ADOQuery,这是怎么回事呀!
还是不行呀,我按照上面的格式写了以后,Delphi会提示一个“CommandText does not return a result set”,我用的控件ADOQuery,这是怎么回事呀!
#4
先创建一个临时表,自己用到的一个例子:
CREATE TABLE #temp_rpt_Stock(
tmp_Customer_No varchar(50),
Item_No01 varchar(50),
Item_No02 varchar(50),
Item_No03 varchar(50),
Item_No11 varchar(50),
Item_No12 varchar(50),
Item_No13 varchar(50),
--Date_Str varchar(20),
Stock_In int,
Stock_Out int,
Stock_Out_2B int,
Stock_Else int,
Stock_Remains int,
Booker varchar(20)--first employee_no and then update to employee_name
)
CREATE TABLE #temp_rpt_Stock(
tmp_Customer_No varchar(50),
Item_No01 varchar(50),
Item_No02 varchar(50),
Item_No03 varchar(50),
Item_No11 varchar(50),
Item_No12 varchar(50),
Item_No13 varchar(50),
--Date_Str varchar(20),
Stock_In int,
Stock_Out int,
Stock_Out_2B int,
Stock_Else int,
Stock_Remains int,
Booker varchar(20)--first employee_no and then update to employee_name
)
#5
当然,临时表要和查询语句放在同一个存储过程中.最后返回结果集.
#6
ADOQUERY吗
直接写select * from table where condition
就可以返回结果集体了
with ADOQuery1 do
begin
close;
sql.clear;
sql.add(select field1,field2,... from table1)
open;
end;
就有结果了啊,
adoquery1.recordcount;//记录数;
adoquery1.fieldbyname('field1').vlaue;//当前记录fieldbyname1的值
直接写select * from table where condition
就可以返回结果集体了
with ADOQuery1 do
begin
close;
sql.clear;
sql.add(select field1,field2,... from table1)
open;
end;
就有结果了啊,
adoquery1.recordcount;//记录数;
adoquery1.fieldbyname('field1').vlaue;//当前记录fieldbyname1的值
#7
不能用ADOQuery1.OPEN,试试ADOQuery1.ExecSQL
#8
select * into #T from table1
Select * from #T
两句写在一起,再用OPEN应该也可以!
Select * from #T
两句写在一起,再用OPEN应该也可以!