sql自定义临时表,临时表含有参数组合的写法

 

var
temp_mx_table,temp_hz_table:string;
begin

    //自定义临时表名
    temp_mx_table:='W_temp_'+Frm_Login.loupanhao+'_shoufeimingxi';
    temp_hz_table:='W_temp_'+Frm_Login.loupanhao+'_huizongmingxi';


    //删除临时表,删除表
    with    ADOQuery_temp   do
    begin
            Close;
            SQL.Clear;
            SQL.Add('if object_id(''W_temp_''+'''+Frm_Login.loupanhao+'''+''_shoufeimingxi'') is not null drop table '+temp_mx_table+' ');
            Execsql();
    end;

    //删除临时表
    with    ADOQuery_temp   do
    begin
            Close;
            SQL.Clear;
            SQL.Add('if object_id(''W_temp_''+'''+Frm_Login.loupanhao+'''+''_huizongmingxi'') is not null drop table '+temp_hz_table+' ');
            Execsql();
    end;

 

end;

 

 

 

 

 

 

 

 

posted on 2016-12-09 14:36  那里的天空  阅读(1752)  评论(0编辑  收藏  举报

导航