作者LPH66 (IWH68S0XZ8M89)
看板Database
标题Re: [SQL ] 如何删除上百笔的资料?
时间Sun Mar 9 14:31:21 2008
※ 引述《Xphenomenon (啦 )》之铭言:
: 假设我有一百笔想要删除的资料,而我知道他们的栏位,我是否可以
: 将他们存在某一个档案里面,然後透过 SQL 的语法一一将他们删除呢?
: 例如:
: 序号.txt 档案
: 466
: 789
: 316
: ...
: ...
: ...
: 649
: 777
: 334
: 以上序号.txt 档案里有各笔纪录的栏位资料,我想要透过 SQL 语法将此
: 档案读入,进而分别删除各笔资料,请问有办法做到吗?
: 谢谢各位大大的回答 :)
直觉想到的做法就是用
别的语言读档建立出
DELETE FROM `table` WHERE (`seqno`=466 OR `seqno`=789 OR ... OR `seqno`=334)
这样的字串 (这用个回圈即可) 然後丢给SQL
--
印象中SQL语言好像没有读档的功能...
--
'You've sort of made up for it tonight,' said Harry. 'Getting the
sword. Finishing the Horcrux. Saving my life.'
'That makes me sound a lot cooler then I was,' Ron mumbled.
'Stuff like that always sounds cooler then it really was,' said
Harry. 'I've been trying to tell you that for years.'
-- Harry Potter and the Deathly Hollows, P.308
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.30.84
1F:推 gargamel:in..再单纯点就建立多行单一条件的delete statment 03/09 20:21
2F:推 Xphenomenon:感谢各位大大的建议 :) 03/09 20:44
3F:推 sniffing:sql本身不能读档,但资料库的工具可以 03/09 23:04