原本是想在一个Tquery中动态的创建一个视图:
create view test as
select month([Getdate]) as yue,avg(cv) as avgcv
from tablename
group by month([Getdate])
oeder by month([Getdate])可是问题是同样的这样一个sql语句,在 with query1 do
begin
close;
sql.clear;
sql.add(该语句);
execsql;
end;
后就报错,如果去掉create view test as 这段,倒是可以正确执行。然后用sql exploer ,发现
create view test as select month([Getdate]) as yue,avg(cv) as avgcv
from tablename
group by month([Getdate])
oeder by month([Getdate])
在这里面是可以正确的产生一个view的。why?
create view test as
select month([Getdate]) as yue,avg(cv) as avgcv
from tablename
group by month([Getdate])
oeder by month([Getdate])可是问题是同样的这样一个sql语句,在 with query1 do
begin
close;
sql.clear;
sql.add(该语句);
execsql;
end;
后就报错,如果去掉create view test as 这段,倒是可以正确执行。然后用sql exploer ,发现
create view test as select month([Getdate]) as yue,avg(cv) as avgcv
from tablename
group by month([Getdate])
oeder by month([Getdate])
在这里面是可以正确的产生一个view的。why?
试试别的ado对象