SQL删除历史数据问题。

来源:百度知道 编辑:UC知道 时间:2024/06/26 04:49:05
请问,我远程连接到虚拟主机数据库,想删除其中一个新闻大类(big1)里一个表(news)里的03-06年的数据,具体应该该如何操作。我是莱鸟,麻烦高手详细说一下,谢谢。
上面写错了,是删除数据库中一个表(news)里的其中一个新闻大类(big1)里03-06年的数据。

delete from news where date between '2003-01-01' and '2006-12-31'
and news.classid=big1

delete from big1.dbo.news where 时间字段名 between '2003-01-01' and '2006-12-31'

begin tran T
DELETE FROM news WHERE 新闻大类= big1
where 时间 >= '2003-01-01'
and 时间 <= '2006-12-31'

COMMIT

远程连接到虚拟主机数据库?
1、是直接SQL连接
2、用SQL脚本连接

方法2链接服务器,方法1用查询分析器连接执行

delete news where big1='..' and year(Date) between 2003 and 2006