一直挑選資料到暫存表,sql語句應該怎麼修改呢? |
答題得分者是:l630521
|
pedro
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:152 回覆:1187 積分:892 註冊:2002-06-12 發送簡訊給我 |
while not qrySelect.Eof do begin CC_CusNo:=qrySelect.fieldByName('CC_CusNo').AsString; qrySelect1.Close; qrySelect1.SQL.Clear; sqlScript:='select * into temp from GetFunction(' quotedstr(CC_CusNo) ')'; qrySelect1.SQL.Text:=sqlScript; qrySelect1.ExecSQL; qrySelect.Next; end;請教我SqlScript應修改成什麼, 才能使第二次不會出現已經有temp的錯誤訊息?謝謝. |
l630521
資深會員 ![]() ![]() ![]() ![]() ![]() 發表:15 回覆:349 積分:372 註冊:2003-02-17 發送簡訊給我 |
while not qrySelect.Eof do
begin
CC_CusNo:=qrySelect.fieldByName('CC_CusNo').AsString;
qrySelect1.Close;
qrySelect1.SQL.Clear;
sqlScript:='insert into temp select * from GetFunction(' quotedstr(CC_CusNo) ')';
qrySelect1.SQL.Text:=sqlScript;
qrySelect1.ExecSQL;
qrySelect.Next;
end; 請試試看是否可行! Ian
|
change.jian
版主 ![]() ![]() ![]() ![]() ![]() 發表:29 回覆:620 積分:439 註冊:2003-06-02 發送簡訊給我 |
|
pedro
尊榮會員 ![]() ![]() ![]() ![]() ![]() ![]() 發表:152 回覆:1187 積分:892 註冊:2002-06-12 發送簡訊給我 |
l630521您好, 謝謝您
經您的提示後, 我修正已經可行了
try qrySelect1.SQL.Clear; if qrySelect.Bof then sqlScript:='select * into orgtemp from ..... else sqlScript:='insert into orgtemp select * from .... qrySelect1.SQL.Text:=sqlScript; qrySelect1.ExecSQL;change.jian謝謝您的建議 因為我後端挑選資料後,過一段時間前端會去撈這個表資料,不能確定Connnection是否斷了再連, 所以我不是#temp,而是自己來管理暫存檔,在事前時會drop掉. 發表人 - pedro 於 2004/04/27 12:00:46 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |